rat_event

Trait ConsumedEvent

source
pub trait ConsumedEvent {
    // Required method
    fn is_consumed(&self) -> bool;

    // Provided methods
    fn or_else<F>(self, f: F) -> Self
       where F: FnOnce() -> Self,
             Self: Sized { ... }
    fn or_else_try<F, E>(self, f: F) -> Result<Self, E>
       where Self: Sized,
             F: FnOnce() -> Result<Self, E> { ... }
    fn and<F>(self, f: F) -> Self
       where Self: Sized + Ord,
             F: FnOnce() -> Self { ... }
    fn and_try<F, E>(self, f: F) -> Result<Self, E>
       where Self: Sized + Ord,
             F: FnOnce() -> Result<Self, E> { ... }
}
Expand description

When calling multiple event-handlers, the minimum information required from the result is consumed the event/didn’t consume the event.

See also flow and try_flow macros.

Required Methods§

source

fn is_consumed(&self) -> bool

Is this the ‘consumed’ result.

Provided Methods§

source

fn or_else<F>(self, f: F) -> Self
where F: FnOnce() -> Self, Self: Sized,

Or-Else chaining with is_consumed() as the split.

source

fn or_else_try<F, E>(self, f: F) -> Result<Self, E>
where Self: Sized, F: FnOnce() -> Result<Self, E>,

Or-Else chaining with is_consumed() as the split.

source

fn and<F>(self, f: F) -> Self
where Self: Sized + Ord, F: FnOnce() -> Self,

Then-chaining. Returns max(self, f()).

source

fn and_try<F, E>(self, f: F) -> Result<Self, E>
where Self: Sized + Ord, F: FnOnce() -> Result<Self, E>,

Then-chaining. Returns max(self, f()).

Implementations on Foreign Types§

source§

impl<V, E> ConsumedEvent for Result<V, E>
where V: ConsumedEvent,

Implementors§