pub enum EventResult {
Ignored,
Consumed(Option<Callback>),
}Expand description
Answer to an event notification. The event can be consumed or ignored.
Variants§
Ignored
The event was ignored. The parent can keep handling it.
Consumed(Option<Callback>)
The event was consumed. An optional callback to run is attached.
Implementations§
Source§impl EventResult
impl EventResult
Sourcepub fn with_cb_once<F>(f: F) -> Self
pub fn with_cb_once<F>(f: F) -> Self
Convenient method to create Consumed(Some(f))
After being called once, the callback will become a no-op.
Sourcepub fn is_consumed(&self) -> bool
pub fn is_consumed(&self) -> bool
Returns true if self is EventResult::Consumed.
Sourcepub fn has_callback(&self) -> bool
pub fn has_callback(&self) -> bool
Returns true if self contains a callback.
Sourcepub fn process(self, s: &mut Cursive)
pub fn process(self, s: &mut Cursive)
Process this result if it is a callback.
Does nothing otherwise.
Sourcepub fn or_else<F>(self, f: F) -> Selfwhere
F: FnOnce() -> EventResult,
pub fn or_else<F>(self, f: F) -> Selfwhere
F: FnOnce() -> EventResult,
Returns self if it is not EventResult::Ignored, otherwise returns f().
Auto Trait Implementations§
impl Freeze for EventResult
impl !RefUnwindSafe for EventResult
impl Send for EventResult
impl Sync for EventResult
impl Unpin for EventResult
impl !UnwindSafe for EventResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more