pub struct Map<S, F> { /* private fields */ }Expand description
A strategy that maps values from one type to another
To enable proper shrinking through map, we need to store the original input
alongside the mapped output. This is done using MappedValue.
Trait Implementations§
Source§impl<S, F, U> Strategy for Map<S, F>
impl<S, F, U> Strategy for Map<S, F>
Source§type Value = MappedValue<<S as Strategy>::Value, U>
type Value = MappedValue<<S as Strategy>::Value, U>
The type of values this strategy generates
Source§fn generate<R: Rng>(&self, rng: &mut R, config: &GeneratorConfig) -> Self::Value
fn generate<R: Rng>(&self, rng: &mut R, config: &GeneratorConfig) -> Self::Value
Generate a value using this strategy
Source§fn shrink(&self, value: &Self::Value) -> Box<dyn Iterator<Item = Self::Value>>
fn shrink(&self, value: &Self::Value) -> Box<dyn Iterator<Item = Self::Value>>
Create an iterator of shrunk values from the given value
Source§fn map<F, U>(self, f: F) -> Map<Self, F>
fn map<F, U>(self, f: F) -> Map<Self, F>
Map this strategy to produce values of a different type
Auto Trait Implementations§
impl<S, F> Freeze for Map<S, F>
impl<S, F> RefUnwindSafe for Map<S, F>where
S: RefUnwindSafe,
F: RefUnwindSafe,
impl<S, F> Send for Map<S, F>
impl<S, F> Sync for Map<S, F>
impl<S, F> Unpin for Map<S, F>
impl<S, F> UnwindSafe for Map<S, F>where
S: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more