Skip to main content

Fuse

Struct Fuse 

Source
pub struct Fuse<T: LinkReference, H: FnMut(Link<T>, Link<T>) -> Flow> { /* private fields */ }
Expand description

A write-handler wrapper that stops calling the inner handler once it returns Flow::Break.

After the first Break, every subsequent call to Fuse::call also returns Break without invoking the wrapped closure.

Implementations§

Source§

impl<T: LinkReference, F: FnMut(Link<T>, Link<T>) -> Flow> Fuse<T, F>

Source

pub fn new(handler: F) -> Self

Wraps handler in a Fuse.

Source

pub fn call(&mut self, before: Link<T>, after: Link<T>) -> Flow

Calls the inner handler unless it has already returned Flow::Break.

Auto Trait Implementations§

§

impl<T, H> Freeze for Fuse<T, H>
where H: Freeze, PhantomData<fn(T)>: Freeze,

§

impl<T, H> RefUnwindSafe for Fuse<T, H>

§

impl<T, H> Send for Fuse<T, H>
where H: Send, PhantomData<fn(T)>: Send,

§

impl<T, H> Sync for Fuse<T, H>
where H: Sync, PhantomData<fn(T)>: Sync,

§

impl<T, H> Unpin for Fuse<T, H>
where H: Unpin, PhantomData<fn(T)>: Unpin,

§

impl<T, H> UnsafeUnpin for Fuse<T, H>

§

impl<T, H> UnwindSafe for Fuse<T, H>

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 = !

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.