pub trait TestCase {
type Args<'a>: Arbitrary<'a>;
type FactoryItem<'a>: Arbitrary<'a>;
// Required method
fn init<'a>(
&self,
args: &mut Self::Args<'a>,
) -> (impl Driver<'a>, impl AsyncFnMut(Self::FactoryItem<'a>));
}Expand description
Required Associated Types§
Sourcetype Args<'a>: Arbitrary<'a>
type Args<'a>: Arbitrary<'a>
Shared state constructed once per test iteration. Both the driver and the factory close over references to this value.
Use () when no shared state is needed, or ArbitraryDefault<T> when you
need a Default-constructed T that doesn’t implement Arbitrary.
Sourcetype FactoryItem<'a>: Arbitrary<'a>
type FactoryItem<'a>: Arbitrary<'a>
An arbitrary value passed to the factory on each invocation. Use () if the
future under test doesn’t need external input; use a concrete type (e.g. u8)
when the future itself consumes data.
Required Methods§
Sourcefn init<'a>(
&self,
args: &mut Self::Args<'a>,
) -> (impl Driver<'a>, impl AsyncFnMut(Self::FactoryItem<'a>))
fn init<'a>( &self, args: &mut Self::Args<'a>, ) -> (impl Driver<'a>, impl AsyncFnMut(Self::FactoryItem<'a>))
Construct a (Driver, factory) pair for one test iteration.
The factory is an async closure that will be called multiple times per
iteration, each time receiving a new FactoryItem.
Cancellation between calls exercises cancel-safety.
This function should be deterministic – derive any randomness from args.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.