Struct Update

Source
pub struct Update<Ef, Ev> {
    pub effects: Vec<Ef>,
    pub events: Vec<Ev>,
}
Expand description

Update test helper holds the result of running an app update using AppTester::update or resolving a request with AppTester::resolve.

Fields§

§effects: Vec<Ef>

Effects requested from the update run

§events: Vec<Ev>

Events dispatched from the update run

Implementations§

Source§

impl<Ef, Ev> Update<Ef, Ev>

Source

pub fn into_effects(self) -> impl Iterator<Item = Ef>

Source

pub fn effects(&self) -> impl Iterator<Item = &Ef>

Source

pub fn effects_mut(&mut self) -> impl Iterator<Item = &mut Ef>

Source

pub fn expect_one_effect(self) -> Ef

Assert that the update contains exactly one effect and zero events, and return the effect

§Panics

Panics if the update contains more than one effect or any events.

Source

pub fn expect_one_event(self) -> Ev

Assert that the update contains exactly one event and zero effects, and return the event

§Panics

Panics if the update contains more than one event or any effects.

Source

pub fn assert_empty(self)

Assert that the update contains no effects or events

§Panics

Panics if the update contains any effects or events.

Source

pub fn take_effects<P>(&mut self, predicate: P) -> VecDeque<Ef>
where P: FnMut(&Ef) -> bool,

Take effects matching the predicate out of the Update and return them, mutating the Update

Source

pub fn take_effects_partitioned_by<P>( &mut self, predicate: P, ) -> (VecDeque<Ef>, VecDeque<Ef>)
where P: FnMut(&Ef) -> bool,

Take all of the effects out of the Update and split them into those matching predicate and the rest

Trait Implementations§

Source§

impl<Ef: Debug, Ev: Debug> Debug for Update<Ef, Ev>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Ef, Ev> Freeze for Update<Ef, Ev>

§

impl<Ef, Ev> RefUnwindSafe for Update<Ef, Ev>

§

impl<Ef, Ev> Send for Update<Ef, Ev>
where Ef: Send, Ev: Send,

§

impl<Ef, Ev> Sync for Update<Ef, Ev>
where Ef: Sync, Ev: Sync,

§

impl<Ef, Ev> Unpin for Update<Ef, Ev>
where Ef: Unpin, Ev: Unpin,

§

impl<Ef, Ev> UnwindSafe for Update<Ef, Ev>
where Ef: UnwindSafe, Ev: 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.