pub struct Size<G, F = fn(_: f64) -> f64>(pub G, pub F);Tuple Fields§
§0: G§1: FTrait Implementations§
source§impl<G: Generate, F: Fn(f64) -> f64> Generate for Size<G, F>
impl<G: Generate, F: Fn(f64) -> f64> Generate for Size<G, F>
type Item = <G as Generate>::Item
type Shrink = <G as Generate>::Shrink
source§fn generate(&self, state: &mut State) -> Self::Shrink
fn generate(&self, state: &mut State) -> Self::Shrink
Primary method of this trait. It generates a
Shrink instance that will be able to produce values of type
Generate::Item and shrink itself.source§fn filter<F: Fn(&Self::Item) -> bool>(self, filter: F) -> Filter<Self, F>
fn filter<F: Fn(&Self::Item) -> bool>(self, filter: F) -> Filter<Self, F>
Same as
Generate::filter_with but with a predefined number of retries.source§fn filter_with<F: Fn(&Self::Item) -> bool>(
self,
retries: usize,
filter: F,
) -> Filter<Self, F>
fn filter_with<F: Fn(&Self::Item) -> bool>( self, retries: usize, filter: F, ) -> Filter<Self, F>
Generates many
Generate::Item with an increasingly large size until the filter function F is satisfied, up to
the maximum number of retries. Read moresource§fn filter_map<T, F: Fn(Self::Item) -> Option<T>>(
self,
map: F,
) -> FilterMap<Self, F>
fn filter_map<T, F: Fn(Self::Item) -> Option<T>>( self, map: F, ) -> FilterMap<Self, F>
Same as
Generate::filter_map_with but with a predefined number of retries.source§fn filter_map_with<T, F: Fn(Self::Item) -> Option<T>>(
self,
retries: usize,
map: F,
) -> FilterMap<Self, F>
fn filter_map_with<T, F: Fn(Self::Item) -> Option<T>>( self, retries: usize, map: F, ) -> FilterMap<Self, F>
Combines
Generate::map and Generate::filter in a single Generate implementation where the map function
is considered to satisfy the filter when a [Some(T)] is produced.source§fn array<const N: usize>(self) -> Array<Self, N>
fn array<const N: usize>(self) -> Array<Self, N>
Generates
N items and fills an array with it.source§fn collect<F: FromIterator<Self::Item>>(self) -> Collect<Self, Range<usize>, F>
fn collect<F: FromIterator<Self::Item>>(self) -> Collect<Self, Range<usize>, F>
Same as
Generate::collect_with but with a predefined count.source§fn collect_with<C: Generate<Item = usize>, F: FromIterator<Self::Item>>(
self,
count: C,
) -> Collect<Self, C, F>
fn collect_with<C: Generate<Item = usize>, F: FromIterator<Self::Item>>( self, count: C, ) -> Collect<Self, C, F>
Generates a variable number of items based on the provided
count Generate and then builds a value of type
F based on its implementation of FromIterator.source§fn size<F: Fn(f64, usize) -> f64>(self, map: F) -> Size<Self, F>
fn size<F: Fn(f64, usize) -> f64>(self, map: F) -> Size<Self, F>
Maps the current
size of the generation process to a different one. The size is a value in the range [0.0..1.0]
that represents how big the generated items are based on the generator’s constraints. The generation process will
initially try to produce small items and then move on to bigger ones.
Note that the size does not guarantee a small or big generated item since Generate implementations are free
to interpret it as they wish, although that is its intention. Read moresource§fn dampen(self) -> Dampen<Self>
fn dampen(self) -> Dampen<Self>
Same as
Generate::dampen_with but with predefined arguments.source§fn dampen_with(
self,
pressure: f64,
deepest: usize,
limit: usize,
) -> Dampen<Self>
fn dampen_with( self, pressure: f64, deepest: usize, limit: usize, ) -> Dampen<Self>
Dampens the
size (see Generate::size for more information about size) as items are generated. Read moresource§fn keep(self) -> Keep<Self>
fn keep(self) -> Keep<Self>
Keeps the generated items intact through the shrinking process (i.e. un-shrinked).
source§fn sampler(&self) -> Sampler<'_, Self>
fn sampler(&self) -> Sampler<'_, Self>
Provides a
Sampler that allows to configure sampling settings and generate samples.source§fn samples(&self, count: usize) -> Samples<'_, Self> ⓘ
fn samples(&self, count: usize) -> Samples<'_, Self> ⓘ
Generates
count random values the are progressively larger in size. For additional sampling settings, see Generate::sampler.source§fn sample(&self, size: f64) -> Self::Item
fn sample(&self, size: f64) -> Self::Item
Generates a random value of
size (0.0..=1.0). For additional sampling settings, see Generate::sampler.fn checker(&self) -> Checker<'_, Self>
fn checks<P: Prove, F: FnMut(&Self::Item) -> P>( &self, count: usize, check: F, ) -> Checks<'_, Self, F> ⓘ
fn check<P: Prove, F: FnMut(&Self::Item) -> P>( &self, count: usize, check: F, ) -> Result<(), Error<Self::Item, P>>
Auto Trait Implementations§
impl<G, F> Freeze for Size<G, F>
impl<G, F> RefUnwindSafe for Size<G, F>where
G: RefUnwindSafe,
F: RefUnwindSafe,
impl<G, F> Send for Size<G, F>
impl<G, F> Sync for Size<G, F>
impl<G, F> Unpin for Size<G, F>
impl<G, F> UnwindSafe for Size<G, F>where
G: 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