Skip to main content

ArbitraryF1

Trait ArbitraryF1 

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

Source

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§

Source

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§

Source

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = Probability

Source§

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

Source§

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

Source§

type Parameters = Probability

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

impl<A: Debug + 'static> ArbitraryF1<A> for Saturating<A>

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = <B as Arbitrary>::Parameters

Source§

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

Source§

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

Source§

type Parameters = <B as Arbitrary>::Parameters

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = Probability

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = SizeRange

Source§

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

Source§

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

Source§

type Parameters = ()

Source§

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

Implementors§