Type Alias SMapped
pub type SMapped<I, O> = Map<<I as Arbitrary>::Strategy, fn(_: I) -> O>;
Expand description
A static map from a strategy of I
to O
.
§Stability
This is provided to make documentation more readable. Do not rely on it existing in your own code.
Aliased Type§
struct SMapped<I, O> { /* private fields */ }
Implementations
Trait Implementations
§impl<S, F> Strategy for Map<S, F>
impl<S, F> Strategy for Map<S, F>
§type Value = <F as MapFn<<S as Strategy>::Value>>::Output
type Value = <F as MapFn<<S as Strategy>::Value>>::Output
The type of value used by functions under test generated by this Strategy. Read more
§fn new_tree(
&self,
runner: &mut TestRunner,
) -> Result<<Map<S, F> as Strategy>::Tree, Reason>
fn new_tree( &self, runner: &mut TestRunner, ) -> Result<<Map<S, F> as Strategy>::Tree, Reason>
Generate a new value tree from the given runner. Read more
§fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
fn prop_map<O, F>(self, fun: F) -> Map<Self, F>
Returns a strategy which produces values transformed by the function
fun
. Read more§fn prop_map_into<O>(self) -> MapInto<Self, O>
fn prop_map_into<O>(self) -> MapInto<Self, O>
§fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
fn prop_perturb<O, F>(self, fun: F) -> Perturb<Self, F>
Returns a strategy which produces values transformed by the function
fun
, which is additionally given a random number generator. Read more§fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
fn prop_flat_map<S, F>(self, fun: F) -> Flatten<Map<Self, F>>
Maps values produced by this strategy into new strategies and picks
values from those strategies. Read more
§fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
fn prop_ind_flat_map<S, F>(self, fun: F) -> IndFlatten<Map<Self, F>>
Maps values produced by this strategy into new strategies and picks
values from those strategies while considering the new strategies to be
independent. Read more
§fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
fn prop_ind_flat_map2<S, F>(self, fun: F) -> IndFlattenMap<Self, F>
Similar to
prop_ind_flat_map()
, but produces 2-tuples with the input
generated from self
in slot 0 and the derived strategy in slot 1. Read more§fn prop_filter<R, F>(self, whence: R, fun: F) -> Filter<Self, F>
fn prop_filter<R, F>(self, whence: R, fun: F) -> Filter<Self, F>
Returns a strategy which only produces values accepted by
fun
. Read more§fn prop_filter_map<F, O>(
self,
whence: impl Into<Reason>,
fun: F,
) -> FilterMap<Self, F>
fn prop_filter_map<F, O>( self, whence: impl Into<Reason>, fun: F, ) -> FilterMap<Self, F>
Returns a strategy which only produces transformed values where
fun
returns Some(value)
and rejects those where fun
returns None
. Read more§fn prop_union(self, other: Self) -> Union<Self>where
Self: Sized,
fn prop_union(self, other: Self) -> Union<Self>where
Self: Sized,
§fn prop_recursive<R, F>(
self,
depth: u32,
desired_size: u32,
expected_branch_size: u32,
recurse: F,
) -> Recursive<Self::Value, F>
fn prop_recursive<R, F>( self, depth: u32, desired_size: u32, expected_branch_size: u32, recurse: F, ) -> Recursive<Self::Value, F>
Generate a recursive structure with
self
items as leaves. Read more§fn prop_shuffle(self) -> Shuffle<Self>
fn prop_shuffle(self) -> Shuffle<Self>
Shuffle the contents of the values produced by this strategy. Read more
§fn boxed(self) -> BoxedStrategy<Self::Value>where
Self: Sized + 'static,
fn boxed(self) -> BoxedStrategy<Self::Value>where
Self: Sized + 'static,
Erases the type of this
Strategy
so it can be passed around as a
simple trait object. Read more§fn sboxed(self) -> SBoxedStrategy<Self::Value>
fn sboxed(self) -> SBoxedStrategy<Self::Value>
Erases the type of this
Strategy
so it can be passed around as a
simple trait object. Read more§impl<S, F> ValueTree for Map<S, F>
impl<S, F> ValueTree for Map<S, F>
§type Value = <F as MapFn<<S as ValueTree>::Value>>::Output
type Value = <F as MapFn<<S as ValueTree>::Value>>::Output
The type of the value produced by this
ValueTree
.§fn simplify(&mut self) -> bool
fn simplify(&mut self) -> bool
Attempts to simplify the current value. Notionally, this sets the
“high” value to the current value, and the current value to a “halfway
point” between high and low, rounding towards low. Read more
§fn complicate(&mut self) -> bool
fn complicate(&mut self) -> bool
Attempts to partially undo the last simplification. Notionally, this
sets the “low” value to one plus the current value, and the current
value to a “halfway point” between high and the new low, rounding
towards low. Read more