Struct checkito::same::Same

source ·
pub struct Same<T: ?Sized>(pub T);

Tuple Fields§

§0: T

Trait Implementations§

source§

impl<T: Clone + ?Sized> Clone for Same<T>

source§

fn clone(&self) -> Same<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + ?Sized> Debug for Same<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default + ?Sized> Default for Same<T>

source§

fn default() -> Same<T>

Returns the “default value” for a type. Read more
source§

impl<T: Default + Clone> FullGenerate for Same<T>

source§

impl<T: Clone> FullShrink for Same<T>

source§

type Item = T

source§

type Shrink = Same<T>

source§

fn shrinker(item: Self::Item) -> Option<Self::Shrink>

source§

impl<T: Clone> Generate for Same<T>

source§

type Item = T

source§

type Shrink = Same<T>

source§

fn generate(&self, _: &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 boxed(self) -> Generator<Self::Item>
where Self: Sized + 'static, Generator<Self::Item>: Generate,

Wraps self in a boxed Generate. This is notably relevant for recursive Generate implementations where the type would otherwise be infinite. Read more
source§

fn map<T, F: Fn(Self::Item) -> T>(self, map: F) -> Map<Self, F>
where Self: Sized, Map<Self, F>: Generate,

Maps generated Generate::Item to an arbitrary type T using the provided function F.
source§

fn filter<F: Fn(&Self::Item) -> bool>(self, filter: F) -> Filter<Self, F>
where Self: Sized, Filter<Self, F>: Generate,

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>
where Self: Sized, Filter<Self, F>: Generate,

Generates many Generate::Item with an increasingly large size until the filter function F is satisfied, up to the maximum number of retries. Read more
source§

fn filter_map<T, F: Fn(Self::Item) -> Option<T>>( self, map: F, ) -> FilterMap<Self, F>
where Self: Sized, FilterMap<Self, F>: Generate,

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>
where Self: Sized, FilterMap<Self, F>: Generate,

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 flat_map<G: Generate, F: Fn(Self::Item) -> G>( self, map: F, ) -> Flatten<Map<Self, F>>
where Self: Sized, Map<Self, F>: Generate<Item = G>, Flatten<Map<Self, F>>: Generate,

Combines Generate::map and Generate::flatten in a single Generate implementation.
source§

fn array<const N: usize>(self) -> Array<Self, N>
where Self: Sized, Array<Self, N>: Generate,

Generates N items and fills an array with it.
source§

fn collect<F: FromIterator<Self::Item>>(self) -> Collect<Self, Range<usize>, F>
where Self: Sized, Collect<Self, Range<usize>, F>: Generate,

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>
where Self: Sized, Collect<Self, C, F>: Generate,

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>
where Self: Sized, Size<Self, F>: Generate,

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 more
source§

fn dampen(self) -> Dampen<Self>
where Self: Sized, Size<Self>: Generate,

Same as Generate::dampen_with but with predefined arguments.
source§

fn dampen_with( self, pressure: f64, deepest: usize, limit: usize, ) -> Dampen<Self>
where Self: Sized, Dampen<Self>: Generate,

Dampens the size (see Generate::size for more information about size) as items are generated. Read more
source§

fn keep(self) -> Keep<Self>
where Self: Sized, Keep<Self>: Generate,

Keeps the generated items intact through the shrinking process (i.e. un-shrinked).
source§

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>

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

Generates a random value of size (0.0..=1.0). For additional sampling settings, see Generate::sampler.
source§

fn checker(&self) -> Checker<'_, Self>

source§

fn checks<P: Prove, F: FnMut(&Self::Item) -> P>( &self, count: usize, check: F, ) -> Checks<'_, Self, F>

source§

fn check<P: Prove, F: FnMut(&Self::Item) -> P>( &self, count: usize, check: F, ) -> Result<(), Error<Self::Item, P>>

source§

impl<T: Clone> IntoShrink for Same<T>

source§

type Item = T

source§

type Shrink = Same<T>

source§

fn shrinker(&self, item: Self::Item) -> Option<Self::Shrink>

source§

impl<T: Clone> Shrink for Same<T>

source§

type Item = T

source§

fn item(&self) -> Self::Item

source§

fn shrink(&mut self) -> Option<Self>

source§

fn boxed(self) -> Shrinker<Self::Item>
where Self: 'static,

Auto Trait Implementations§

§

impl<T> Freeze for Same<T>
where T: Freeze + ?Sized,

§

impl<T> RefUnwindSafe for Same<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Send for Same<T>
where T: Send + ?Sized,

§

impl<T> Sync for Same<T>
where T: Sync + ?Sized,

§

impl<T> Unpin for Same<T>
where T: Unpin + ?Sized,

§

impl<T> UnwindSafe for Same<T>
where T: UnwindSafe + ?Sized,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.