zebra_test::prelude::prop::sample

Function select

pub fn select<T>(values: impl Into<Cow<'static, [T]>>) -> Select<T>
where T: Clone + Debug + 'static,
Expand description

Create a strategy which uniformly selects one value from values.

values should be a &'static [T] or a Vec<T>, or potentially another type that can be coerced to Cow<'static,[T]>.

This is largely equivalent to making a Union of a bunch of Just strategies, but is substantially more efficient and shrinks by binary search.

If values is also to be generated by a strategy, see Index for a more efficient way to select values than using prop_flat_map().