zebra_test::prelude::prop::arbitrary::functor

Trait ArbitraryF1

pub trait ArbitraryF1<A>: Sized + Debug
where 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

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,

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 of SomeType. The composite strategy is passed the arguments given in args.

If you wish to use the default() arguments, use lift1 instead.

Provided Methods§

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.

Implementations on Foreign Types§

§

impl<A> ArbitraryF1<A> for Bound<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Bound<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Bound<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Option<A>
where A: Debug,

§

type Parameters = Probability

§

fn lift1_with<S>( base: S, prob: <Option<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Option<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Result<A, Infallible>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Result<A, Infallible> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Result<A, Infallible>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Box<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Box<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Box<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for BinaryHeap<A>
where A: Debug + Ord,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <BinaryHeap<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<BinaryHeap<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static + Ord,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for BTreeSet<A>
where A: Debug + Ord,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <BTreeSet<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<BTreeSet<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static + Ord,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for LinkedList<A>
where A: Debug,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <LinkedList<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<LinkedList<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for VecDeque<A>
where A: Debug,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <VecDeque<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<VecDeque<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Rc<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Rc<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Rc<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Arc<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Arc<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Arc<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Vec<A>
where A: Debug,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <Vec<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Vec<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Cell<A>
where A: Debug + 'static + Copy,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Cell<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Cell<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for RefCell<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <RefCell<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<RefCell<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for UnsafeCell<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <UnsafeCell<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<UnsafeCell<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Reverse<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Reverse<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Reverse<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Cycle<A>
where A: Debug + 'static + Iterator + Clone,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Cycle<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Cycle<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Enumerate<A>
where A: Debug + 'static + Iterator,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Enumerate<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Enumerate<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Fuse<A>
where A: Debug + 'static + Iterator,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Fuse<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Fuse<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Rev<A>
where A: Debug + 'static + DoubleEndedIterator,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Rev<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Rev<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Skip<A>
where A: Debug + Iterator,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Skip<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Skip<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Take<A>
where A: Debug + Iterator,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Take<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Take<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Once<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Once<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Once<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Repeat<A>
where A: Debug + 'static + Clone,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Repeat<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Repeat<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Discriminant<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Discriminant<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Discriminant<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Wrapping<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Wrapping<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Wrapping<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Range<A>
where A: Debug + PartialOrd,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Range<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Range<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for RangeFrom<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <RangeFrom<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<RangeFrom<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for RangeInclusive<A>
where A: Debug + PartialOrd,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <RangeInclusive<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<RangeInclusive<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for RangeTo<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <RangeTo<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<RangeTo<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for RangeToInclusive<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <RangeToInclusive<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<RangeToInclusive<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static,

§

type Parameters = Probability

§

fn lift1_with<S>( base: S, prob: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for AssertUnwindSafe<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <AssertUnwindSafe<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<AssertUnwindSafe<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static,

§

type Parameters = Probability

§

fn lift1_with<S>( base: S, args: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for HashSet<A>
where A: Debug + Hash + Eq,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <HashSet<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<HashSet<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for IntoIter<A>
where A: Debug + 'static + Hash + Eq,

§

type Parameters = SizeRange

§

fn lift1_with<S>( base: S, args: <IntoIter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for BufReader<A>
where A: Debug + Read,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <BufReader<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<BufReader<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for BufWriter<A>
where A: Debug + Write,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <BufWriter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<BufWriter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for LineWriter<A>
where A: Debug + Write,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <LineWriter<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<LineWriter<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Cursor<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Cursor<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Cursor<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Lines<A>
where A: Debug + 'static + BufRead,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Lines<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Lines<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Split<A>
where A: Debug + 'static + BufRead,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Split<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Split<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Take<A>
where A: Debug + 'static + Read,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Take<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Take<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for Mutex<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Mutex<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Mutex<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A> ArbitraryF1<A> for RwLock<A>
where A: Debug + 'static,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <RwLock<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<RwLock<A>>
where S: Strategy<Value = A> + 'static,

§

impl<A, B> ArbitraryF1<A> for Cow<'static, B>
where A: Debug + Borrow<B> + 'static, B: ToOwned<Owned = A> + Debug + ?Sized,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Cow<'static, B> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Cow<'static, B>>
where S: Strategy<Value = A> + 'static,

§

impl<A, B> ArbitraryF1<A> for Zip<B, A>
where A: Debug + 'static + Iterator, B: 'static + Arbitrary + Iterator,

§

type Parameters = <B as Arbitrary>::Parameters

§

fn lift1_with<S>( base: S, args: <Zip<B, A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Zip<B, A>>
where S: Strategy<Value = A> + 'static,

§

impl<A, B, T> ArbitraryF1<A> for Chain<B, A>
where A: Debug + 'static + Iterator<Item = T>, B: 'static + Arbitrary + Iterator<Item = T>,

§

type Parameters = <B as Arbitrary>::Parameters

§

fn lift1_with<S>( base: S, args: <Chain<B, A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Chain<B, A>>
where S: Strategy<Value = A> + 'static,

§

impl<A, E> ArbitraryF1<A> for Result<A, E>
where A: Debug, E: Arbitrary, <E as Arbitrary>::Strategy: 'static,

§

type Parameters = (Probability, <E as Arbitrary>::Parameters)

§

fn lift1_with<AS>( base: AS, args: <Result<A, E> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Result<A, E>>
where AS: Strategy<Value = A> + 'static,

§

impl<A, K> ArbitraryF1<A> for BTreeMap<K, A>
where A: Debug, K: Ord + Arbitrary + 'static,

§

type Parameters = (SizeRange, <K as Arbitrary>::Parameters)

§

fn lift1_with<S>( base: S, args: <BTreeMap<K, A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<BTreeMap<K, A>>
where S: Strategy<Value = A> + 'static,

§

impl<A, K> ArbitraryF1<A> for HashMap<K, A>
where A: Debug, K: Hash + Eq + Arbitrary + 'static,

§

type Parameters = (SizeRange, <K as Arbitrary>::Parameters)

§

fn lift1_with<S>( base: S, args: <HashMap<K, A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<HashMap<K, A>>
where S: Strategy<Value = A> + 'static,

§

impl<A, K> ArbitraryF1<A> for IntoIter<K, A>
where A: Debug + 'static, K: Hash + Eq + Arbitrary + 'static,

§

type Parameters = (SizeRange, <K as Arbitrary>::Parameters)

§

fn lift1_with<S>( base: S, args: <IntoIter<K, A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<IntoIter<K, A>>
where S: Strategy<Value = A> + 'static,

§

impl<A, T> ArbitraryF1<A> for Peekable<A>
where A: Debug + 'static + Iterator<Item = T>, T: Debug,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Peekable<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Peekable<A>>
where S: Strategy<Value = A> + 'static,

§

impl<T, A> ArbitraryF1<A> for Cloned<A>
where T: 'static + Clone, A: Debug + 'static + Iterator<Item = &'static T>,

§

type Parameters = ()

§

fn lift1_with<S>( base: S, _args: <Cloned<A> as ArbitraryF1<A>>::Parameters, ) -> BoxedStrategy<Cloned<A>>
where S: Strategy<Value = A> + 'static,

Implementors§