Function proptest_arbitrary::arbitrary
[−]
[src]
pub fn arbitrary<'a, A, S, V, P>() -> S where
P: Default,
V: ValueTree<Value = A>,
S: Strategy<Value = V>,
A: Arbitrary<'a, Strategy = S, ValueTree = V, Parameters = P>,
Generates a Strategy
producing Arbitrary
values of A
.
Works better with type inference than any::<A>()
.
With this version, you shouldn't need to specify any of the (many) type
parameters explicitly. This can have a positive effect on type inference.
However, if you want specify A
, you should use any::<A>()
instead.
For clarity, it is often a good idea to specify the type generated, and
so using any::<A>()
can be a good idea.
If you want to customize how the strategy is generated, use
arbitrary_with(args)
where args
is of type
<A as Arbitrary>::Parameters
.
Example
The function can be used as:
extern crate proptest_arbitrary; use proptest_arbitrary::{arbitrary, StrategyFor}; fn gen_vec_usize() -> StrategyFor<Vec<usize>> { arbitrary() }