Trait rat_widget::event::ConsumedEvent

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

    // Provided method
    fn or_else<F>(self, f: F) -> Self
       where F: FnOnce() -> Self,
             Self: Sized { ... }
}
Expand description

When composing several widgets, the minimum information from the outcome of the inner widget is, whether it used & consumed the event.

This allows shortcutting the event-handling and prevents double interactions with the event. The inner widget can special case an event, and the fallback behaviour on the outer layer should not run too.

Required Methods§

source

fn is_consumed(&self) -> bool

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.

Implementations on Foreign Types§

source§

impl<V> ConsumedEvent for Option<V>
where V: ConsumedEvent,

source§

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

Implementors§