Skip to main content

Candidates

Struct Candidates 

Source
pub struct Candidates<'a> { /* private fields */ }
Expand description

The set of mutations that can be applied to a value.

This type is used by mutators to register the mutations that they can perform on a value. It is passed to the Mutate::mutate trait method, and provides a way to register candidate mutations, as well as to check if shrinking is enabled.

Implementations§

Source§

impl<'a> Candidates<'a>

Source

pub fn mutation( &mut self, f: impl FnMut(&mut Context) -> Result<()>, ) -> Result<()>

Register a candidate mutation that can be applied to a value.

This method is called by Mutate::mutate implementations to register the potential mutations that they can perform on a value.

f should be a closure that performs the mutation on the value that was passed to Mutate::mutate, updating the value and the mutator itself as necessary.

See the Mutate::mutate trait method documentation for more information on this method’s use.

Source

pub fn shrink(&self) -> bool

Whether only shrinking mutations should be registered in this mutation set or not.

When this method returns true, then you should not register any mutation which can grow the value being mutated.

Auto Trait Implementations§

§

impl<'a> Freeze for Candidates<'a>

§

impl<'a> RefUnwindSafe for Candidates<'a>

§

impl<'a> Send for Candidates<'a>

§

impl<'a> Sync for Candidates<'a>

§

impl<'a> Unpin for Candidates<'a>

§

impl<'a> UnsafeUnpin for Candidates<'a>

§

impl<'a> !UnwindSafe for Candidates<'a>

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> 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, 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.