Trait zebra_test::prelude::prop::arbitrary::functor::ArbitraryF1
pub trait ArbitraryF1<A>: Sized + Debugwhere
A: Debug,{
type Parameters: Default;
// Required method
fn lift1_with<AS>(base: AS, args: Self::Parameters) -> BoxedStrategy<Self>
where AS: Strategy<Value = A> + 'static;
// Provided method
fn lift1<AS>(base: AS) -> BoxedStrategy<Self>
where AS: Strategy<Value = A> + 'static { ... }
}
Expand description
ArbitraryF1
lets you lift a Strategy
to unary
type constructors such as Box
, Vec
, and Option
.
The trait corresponds to
Haskell QuickCheck’s Arbitrary1
type class.
Required Associated Types§
type Parameters: Default
type Parameters: Default
The type of parameters that lift1_with
accepts for
configuration of the lifted and generated Strategy
. Parameters
must implement Default
.
Required Methods§
fn lift1_with<AS>(base: AS, args: Self::Parameters) -> BoxedStrategy<Self>where
AS: Strategy<Value = A> + 'static,
fn lift1_with<AS>(base: AS, args: Self::Parameters) -> BoxedStrategy<Self>where
AS: Strategy<Value = A> + 'static,
Provided Methods§
fn lift1<AS>(base: AS) -> BoxedStrategy<Self>where
AS: Strategy<Value = A> + 'static,
fn lift1<AS>(base: AS) -> BoxedStrategy<Self>where
AS: Strategy<Value = A> + 'static,
Lifts a given Strategy
to a new Strategy
for the (presumably)
bigger type. This is useful for lifting a Strategy
for SomeType
to a container such as Vec<SomeType>
.
Calling this for the type X
is the equivalent of using
X::lift1_with(base, Default::default())
.
This method is defined in the trait for optimization for the default if you want to do that. It is a logic error to not preserve the semantics when overriding.
Object Safety§
This trait is not object safe.