Enum cursive::event::EventResult
source · [−]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
sourceimpl EventResult
impl EventResult
sourcepub fn with_cb<F>(f: F) -> EventResultwhere
F: 'static + Fn(&mut Cursive),
pub fn with_cb<F>(f: F) -> EventResultwhere
F: 'static + Fn(&mut Cursive),
Convenient method to create Consumed(Some(f))
sourcepub fn with_cb_once<F>(f: F) -> EventResultwhere
F: 'static + FnOnce(&mut Cursive),
pub fn with_cb_once<F>(f: F) -> EventResultwhere
F: 'static + FnOnce(&mut Cursive),
Convenient method to create Consumed(Some(f))
After being called once, the callback will become a no-op.
sourcepub fn consumed() -> EventResult
pub fn consumed() -> EventResult
Convenient method to create Consumed(None)
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) -> EventResultwhere
F: FnOnce() -> EventResult,
pub fn or_else<F>(self, f: F) -> EventResultwhere
F: FnOnce() -> EventResult,
Returns self
if it is not EventResult::Ignored
, otherwise returns f()
.
sourcepub fn and(self, other: EventResult) -> EventResult
pub fn and(self, other: EventResult) -> EventResult
Returns an event result that combines self
and other
.
Auto Trait Implementations
impl !RefUnwindSafe for EventResult
impl !Send for EventResult
impl !Sync for EventResult
impl Unpin for EventResult
impl !UnwindSafe for EventResult
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more