[−][src]Trait un_algebra::tests::arbitrary::functor::ArbitraryF2
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, B> ArbitraryF2<A, B> for Result<A, B> where
A: Debug,
B: Debug,
[src]
A: Debug,
B: Debug,
type Parameters = Probability
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: <Result<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<Result<A, B>> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
[src]
fst: AS,
snd: BS,
args: <Result<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<Result<A, B>> 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]
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
impl<A, B> ArbitraryF2<A, B> for IntoIter<A, B> where
A: 'static + Eq + Hash + Debug,
B: 'static + Debug,
[src]
A: 'static + Eq + Hash + Debug,
B: 'static + Debug,
type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: <IntoIter<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<IntoIter<A, B>> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
[src]
fst: AS,
snd: BS,
args: <IntoIter<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<IntoIter<A, B>> 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]
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
impl<T, A, B> ArbitraryF2<A, B> for Chain<A, B> where
A: Iterator<Item = T> + Debug,
B: Iterator<Item = T> + Debug,
[src]
A: Iterator<Item = T> + Debug,
B: Iterator<Item = T> + Debug,
type Parameters = ()
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
_args: <Chain<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<Chain<A, B>> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
[src]
fst: AS,
snd: BS,
_args: <Chain<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<Chain<A, B>> 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]
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
impl<A, B> ArbitraryF2<A, B> for IntoIter<A, B> where
A: 'static + Ord + Debug,
B: 'static + Debug,
[src]
A: 'static + Ord + Debug,
B: 'static + Debug,
type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: <IntoIter<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<IntoIter<A, B>> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
[src]
fst: AS,
snd: BS,
args: <IntoIter<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<IntoIter<A, B>> 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]
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
impl<A, B> ArbitraryF2<A, B> for BTreeMap<A, B> where
A: Ord + Debug,
B: Debug,
[src]
A: Ord + Debug,
B: Debug,
type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: <BTreeMap<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<BTreeMap<A, B>> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
[src]
fst: AS,
snd: BS,
args: <BTreeMap<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<BTreeMap<A, B>> 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]
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
impl<A, B> ArbitraryF2<A, B> for HashMap<A, B, RandomState> where
A: Eq + Hash + Debug,
B: Debug,
[src]
A: Eq + Hash + Debug,
B: Debug,
type Parameters = SizeRange
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
args: <HashMap<A, B, RandomState> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<HashMap<A, B, RandomState>> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
[src]
fst: AS,
snd: BS,
args: <HashMap<A, B, RandomState> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<HashMap<A, B, RandomState>> 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]
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
impl<A, B> ArbitraryF2<A, B> for Zip<A, B> where
A: Iterator + Debug,
B: Iterator + Debug,
[src]
A: Iterator + Debug,
B: Iterator + Debug,
type Parameters = ()
fn lift2_with<AS, BS>(
fst: AS,
snd: BS,
_args: <Zip<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<Zip<A, B>> where
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,
[src]
fst: AS,
snd: BS,
_args: <Zip<A, B> as ArbitraryF2<A, B>>::Parameters
) -> BoxedStrategy<Zip<A, B>> 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]
AS: Strategy<Value = A> + 'static,
BS: Strategy<Value = B> + 'static,