Trait proptest::arbitrary::functor::ArbitraryF2 [−][src]
pub trait ArbitraryF2<A: Debug, B: Debug>: Debug + Sized { type Parameters: Default; fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self>
where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static; fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self>
where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, { ... } }
ArbitraryF2 lets you lift Strategy to binary
type constructors such as Result, HashMap.
The trait corresponds to
Haskell QuickCheck's Arbitrary2 type class.
Associated Types
type Parameters: Default
The type of parameters that lift2_with accepts for
configuration of the lifted and generated Strategy. Parameters
must implement Default.
Required Methods
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
Lifts two given strategies to a new Strategy for the (presumably)
bigger type. This is useful for lifting a Strategy for Type1
and one for Type2 to a container such as HashMap<Type1, Type2>.
The composite strategy is passed the arguments given in args.
If you wish to use the default() arguments,
use lift2 instead.
Provided Methods
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
Lifts two given strategies to a new Strategy for the (presumably)
bigger type. This is useful for lifting a Strategy for Type1
and one for Type2 to a container such as HashMap<Type1, Type2>.
Calling this for the type X is the equivalent of using
X::lift2_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.
Implementations on Foreign Types
impl<A: Debug + Iterator, B: Debug + Iterator> ArbitraryF2<A, B> for Zip<A, B>[src]
impl<A: Debug + Iterator, B: Debug + Iterator> ArbitraryF2<A, B> for Zip<A, B>type Parameters = ()
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
_args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
_args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, impl<T, A: Debug + Iterator<Item = T>, B: Debug + Iterator<Item = T>> ArbitraryF2<A, B> for Chain<A, B>[src]
impl<T, A: Debug + Iterator<Item = T>, B: Debug + Iterator<Item = T>> ArbitraryF2<A, B> for Chain<A, B>type Parameters = ()
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
_args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
_args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, impl<A: Debug, B: Debug> ArbitraryF2<A, B> for Result<A, B>[src]
impl<A: Debug, B: Debug> ArbitraryF2<A, B> for Result<A, B>type Parameters = Probability
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, impl<A: Debug + Eq + Hash, B: Debug> ArbitraryF2<A, B> for HashMap<A, B>[src]
impl<A: Debug + Eq + Hash, B: Debug> ArbitraryF2<A, B> for HashMap<A, B>type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, impl<A: Debug + Eq + Hash + 'static, B: Debug + 'static> ArbitraryF2<A, B> for IntoIter<A, B>[src]
impl<A: Debug + Eq + Hash + 'static, B: Debug + 'static> ArbitraryF2<A, B> for IntoIter<A, B>type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, impl<A: Debug + Ord, B: Debug> ArbitraryF2<A, B> for BTreeMap<A, B>[src]
impl<A: Debug + Ord, B: Debug> ArbitraryF2<A, B> for BTreeMap<A, B>type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, impl<A: Debug + Ord + 'static, B: Debug + 'static> ArbitraryF2<A, B> for IntoIter<A, B>[src]
impl<A: Debug + Ord + 'static, B: Debug + 'static> ArbitraryF2<A, B> for IntoIter<A, B>type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: Self::Parameters
) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static, [src]
fn lift2<AS, BS>(fst: AS, snd: BS) -> BoxedStrategy<Self> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,