Trait gui::Handleable
source · pub trait Handleable<E, M>: Debug {
// Provided methods
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
cap: &'life1 mut dyn MutCap<E, M>,
event: E
) -> Pin<Box<dyn Future<Output = Option<E>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn react<'life0, 'life1, 'async_trait>(
&'life0 self,
message: M,
cap: &'life1 mut dyn MutCap<E, M>
) -> Pin<Box<dyn Future<Output = Option<M>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn respond<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut M,
cap: &'life2 mut dyn MutCap<E, M>
) -> Pin<Box<dyn Future<Output = Option<M>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}
Expand description
A trait representing an object capable of handling events.
Provided Methods§
sourcefn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
cap: &'life1 mut dyn MutCap<E, M>,
event: E
) -> Pin<Box<dyn Future<Output = Option<E>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
cap: &'life1 mut dyn MutCap<E, M>,
event: E
) -> Pin<Box<dyn Future<Output = Option<E>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle an event.
The widget has the option to either consume the event and return nothing, in which case no one else will get informed about it, forward it directly (the default behavior), in which case its parent widget will receive it, or return a completely different event.
sourcefn react<'life0, 'life1, 'async_trait>(
&'life0 self,
message: M,
cap: &'life1 mut dyn MutCap<E, M>
) -> Pin<Box<dyn Future<Output = Option<M>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn react<'life0, 'life1, 'async_trait>(
&'life0 self,
message: M,
cap: &'life1 mut dyn MutCap<E, M>
) -> Pin<Box<dyn Future<Output = Option<M>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
React to a message.
This method is the handler for the MutCap::send
invocation.
sourcefn respond<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut M,
cap: &'life2 mut dyn MutCap<E, M>
) -> Pin<Box<dyn Future<Output = Option<M>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn respond<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut M,
cap: &'life2 mut dyn MutCap<E, M>
) -> Pin<Box<dyn Future<Output = Option<M>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Respond to a message.
This is the handler for the MutCap::call
invocation.