Skip to main content

ConcurrentFixture

Trait ConcurrentFixture 

pub trait ConcurrentFixture: Fixture<Store: Send> { }
Available on non-WebAssembly only.
Expand description

A Fixture whose handles can cross a thread boundary.

§Why the macro needs a name for this and the other two families do not

event_store_conformance! hoists its fixture expression behind async fn __conformance_fixture() -> impl Fixture, so that an emitter never has to name the fixture type — which it could not, having been handed an expression. The opaque return type carries exactly the bounds written on it and nothing else, so impl Fixture tells a caller nothing about <F as Fixture>::Store beyond EventStore. That is enough for two families and one short of enough for this one: the store also has to be Send, and the compiler reports that unsatisfied at every one of the ten call sites the two emitters expand to.

The fix is a trait whose supertrait bound carries the extra obligation, so that impl ConcurrentFixture elaborates to both facts. The blanket implementation means no adapter ever writes it: any fixture whose handle can be moved to another thread already is one.

It is written Fixture<Store: Send> rather than Fixture where Self::Store: Send, and the difference is not cosmetic — an associated-type bound in the supertrait position is elaborated for users of the opaque type, and a where clause on the trait is not.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<F> ConcurrentFixture for F
where F: Fixture, F::Store: Send,