pub trait HandlerExt<A: Clone + 'static> {
// Required methods
fn widget_event(&mut self, args: &A) -> Option<UiTask<()>>;
fn app_event(
&mut self,
handle: Box<dyn AppWeakHandle>,
is_preview: bool,
args: &A,
);
fn filtered(
self,
filter: impl FnMut(&A) -> bool + Send + 'static,
) -> Handler<A>;
fn into_once(self) -> Handler<A>;
fn into_arc(self) -> ArcHandler<A>;
fn into_wgt_runner(self) -> WidgetRunner<A>;
}Expand description
Extension methods for Handler<A>.
Required Methods§
Sourcefn widget_event(&mut self, args: &A) -> Option<UiTask<()>>
fn widget_event(&mut self, args: &A) -> Option<UiTask<()>>
Notify the handler in a widget context.
If the handler is async polls once immediately and returns an UiTask if the future is pending.
The caller must update the task until completion in the same widget context.
Sourcefn app_event(
&mut self,
handle: Box<dyn AppWeakHandle>,
is_preview: bool,
args: &A,
)
fn app_event( &mut self, handle: Box<dyn AppWeakHandle>, is_preview: bool, args: &A, )
Notify the handler outside of any widget or window context, inside a APP_HANDLER context.
If the handler is async polls once and continue execution in UPDATES.
Sourcefn filtered(self, filter: impl FnMut(&A) -> bool + Send + 'static) -> Handler<A>
fn filtered(self, filter: impl FnMut(&A) -> bool + Send + 'static) -> Handler<A>
New handler that only calls for arguments approved by filter.
Sourcefn into_arc(self) -> ArcHandler<A>
fn into_arc(self) -> ArcHandler<A>
Into cloneable handler.
Note that hn_once! and async_hn_once! handlers will still only run once.
Sourcefn into_wgt_runner(self) -> WidgetRunner<A>
fn into_wgt_runner(self) -> WidgetRunner<A>
Wrap the handler into a type that implements the async task management in an widget context.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.