Struct IsoTestApi

Source
pub struct IsoTestApi<A: Iso>(/* private fields */);
Expand description

The API passed into an isotest in the Test context.

The isotest! macro is a bit sneaky, passing in APIs with different function signatures for each context, so that the test can be written the same lexically, but actually expand to two different tests working with two different types.

Implementations§

Source§

impl<A: Iso> IsoTestApi<A>

Source

pub fn new() -> Self

Constructor

Source

pub fn create(&self, a: A) -> A

Create test data from test data (identity function)

Source

pub fn update(&self, a: A, f: impl Fn(A) -> A) -> A

Update test data with a function over test data (simple map)

Source

pub fn mutate(&self, a: &mut A, f: impl Fn(&mut A))

Mutate test data with a function over test data (simple mutable map)

Source

pub fn context(&self) -> IsotestContext

Return the context we’re in

Auto Trait Implementations§

§

impl<A> Freeze for IsoTestApi<A>

§

impl<A> RefUnwindSafe for IsoTestApi<A>
where A: RefUnwindSafe,

§

impl<A> Send for IsoTestApi<A>
where A: Send,

§

impl<A> Sync for IsoTestApi<A>
where A: Sync,

§

impl<A> Unpin for IsoTestApi<A>
where A: Unpin,

§

impl<A> UnwindSafe for IsoTestApi<A>
where A: UnwindSafe,

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.