Expand description
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;
use proptest::arbitrary::{arbitrary, StrategyFor};
fn gen_vec_usize() -> StrategyFor<Vec<usize>> {
arbitrary()
}