Struct proptest::strategy::TupleUnion[][src]

#[must_use = "strategies do nothing unless used"]pub struct TupleUnion<T>(_);

Similar to Union, but internally uses a tuple to hold the strategies.

This allows better performance than vanilla Union since one does not need to resort to boxing and dynamic dispatch to handle heterogeneous strategies.

The difference between this and TupleUnion is that with this, value trees for variants that aren't picked at first are generated lazily.

Implementations

impl<T> TupleUnion<T>[src]

pub fn new(tuple: T) -> Self[src]

Wrap tuple in a TupleUnion.

The struct definition allows any T for tuple, but to be useful, it must be a 2- to 10-tuple of (u32, Arc<impl Strategy>) pairs where all strategies ultimately produce the same value. Each u32 indicates the relative weight of its corresponding strategy. You may use WA<S> as an alias for (u32, Arc<S>).

Using this constructor directly is discouraged; prefer to use prop_oneof! since it is generally clearer.

Trait Implementations

impl<T: Clone> Clone for TupleUnion<T>[src]

impl<T: Copy> Copy for TupleUnion<T>[src]

impl<T: Debug> Debug for TupleUnion<T>[src]

impl<A: Strategy, B: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>, D: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>, WA<D>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>, Option<LazyValueTree<D>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>, D: Strategy<Value = A::Value>, E: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>, WA<D>, WA<E>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>, Option<LazyValueTree<D>>, Option<LazyValueTree<E>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>, D: Strategy<Value = A::Value>, E: Strategy<Value = A::Value>, F: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>, WA<D>, WA<E>, WA<F>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>, Option<LazyValueTree<D>>, Option<LazyValueTree<E>>, Option<LazyValueTree<F>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>, D: Strategy<Value = A::Value>, E: Strategy<Value = A::Value>, F: Strategy<Value = A::Value>, G: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>, WA<D>, WA<E>, WA<F>, WA<G>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>, Option<LazyValueTree<D>>, Option<LazyValueTree<E>>, Option<LazyValueTree<F>>, Option<LazyValueTree<G>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>, D: Strategy<Value = A::Value>, E: Strategy<Value = A::Value>, F: Strategy<Value = A::Value>, G: Strategy<Value = A::Value>, H: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>, WA<D>, WA<E>, WA<F>, WA<G>, WA<H>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>, Option<LazyValueTree<D>>, Option<LazyValueTree<E>>, Option<LazyValueTree<F>>, Option<LazyValueTree<G>>, Option<LazyValueTree<H>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>, D: Strategy<Value = A::Value>, E: Strategy<Value = A::Value>, F: Strategy<Value = A::Value>, G: Strategy<Value = A::Value>, H: Strategy<Value = A::Value>, I: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>, WA<D>, WA<E>, WA<F>, WA<G>, WA<H>, WA<I>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>, Option<LazyValueTree<D>>, Option<LazyValueTree<E>>, Option<LazyValueTree<F>>, Option<LazyValueTree<G>>, Option<LazyValueTree<H>>, Option<LazyValueTree<I>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

impl<A: Strategy, B: Strategy<Value = A::Value>, C: Strategy<Value = A::Value>, D: Strategy<Value = A::Value>, E: Strategy<Value = A::Value>, F: Strategy<Value = A::Value>, G: Strategy<Value = A::Value>, H: Strategy<Value = A::Value>, I: Strategy<Value = A::Value>, J: Strategy<Value = A::Value>> Strategy for TupleUnion<(WA<A>, WA<B>, WA<C>, WA<D>, WA<E>, WA<F>, WA<G>, WA<H>, WA<I>, WA<J>)>[src]

type Tree = TupleUnionValueTree<(LazyValueTree<A>, Option<LazyValueTree<B>>, Option<LazyValueTree<C>>, Option<LazyValueTree<D>>, Option<LazyValueTree<E>>, Option<LazyValueTree<F>>, Option<LazyValueTree<G>>, Option<LazyValueTree<H>>, Option<LazyValueTree<I>>, Option<LazyValueTree<J>>)>

The value tree generated by this Strategy.

type Value = A::Value

The type of value used by functions under test generated by this Strategy. Read more

Auto Trait Implementations

impl<T> Send for TupleUnion<T> where
    T: Send
[src]

impl<T> Sync for TupleUnion<T> where
    T: Sync
[src]

impl<T> Unpin for TupleUnion<T> where
    T: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,