pub struct LifecycleManager { /* private fields */ }Expand description
Manager for widget lifecycle hooks.
Implementations§
Source§impl LifecycleManager
impl LifecycleManager
Sourcepub fn new() -> LifecycleManager
pub fn new() -> LifecycleManager
Create a new lifecycle manager.
Sourcepub fn register(
&mut self,
widget_id: WidgetId,
phases: Vec<LifecyclePhase>,
callback: Box<dyn FnMut(LifecycleEvent) + Send>,
) -> HookId
pub fn register( &mut self, widget_id: WidgetId, phases: Vec<LifecyclePhase>, callback: Box<dyn FnMut(LifecycleEvent) + Send>, ) -> HookId
Register a lifecycle hook.
Returns a hook ID that can be used to unregister the hook.
Sourcepub fn on_mount(
&mut self,
widget_id: WidgetId,
callback: Box<dyn FnMut(LifecycleEvent) + Send>,
) -> HookId
pub fn on_mount( &mut self, widget_id: WidgetId, callback: Box<dyn FnMut(LifecycleEvent) + Send>, ) -> HookId
Register a mount hook.
Sourcepub fn on_unmount(
&mut self,
widget_id: WidgetId,
callback: Box<dyn FnMut(LifecycleEvent) + Send>,
) -> HookId
pub fn on_unmount( &mut self, widget_id: WidgetId, callback: Box<dyn FnMut(LifecycleEvent) + Send>, ) -> HookId
Register an unmount hook.
Sourcepub fn on_update(
&mut self,
widget_id: WidgetId,
callback: Box<dyn FnMut(LifecycleEvent) + Send>,
) -> HookId
pub fn on_update( &mut self, widget_id: WidgetId, callback: Box<dyn FnMut(LifecycleEvent) + Send>, ) -> HookId
Register an update hook.
Sourcepub fn on_focus(
&mut self,
widget_id: WidgetId,
callback: Box<dyn FnMut(LifecycleEvent) + Send>,
) -> HookId
pub fn on_focus( &mut self, widget_id: WidgetId, callback: Box<dyn FnMut(LifecycleEvent) + Send>, ) -> HookId
Register a focus hook.
Sourcepub fn on_blur(
&mut self,
widget_id: WidgetId,
callback: Box<dyn FnMut(LifecycleEvent) + Send>,
) -> HookId
pub fn on_blur( &mut self, widget_id: WidgetId, callback: Box<dyn FnMut(LifecycleEvent) + Send>, ) -> HookId
Register a blur hook.
Sourcepub fn unregister(&mut self, hook_id: HookId) -> bool
pub fn unregister(&mut self, hook_id: HookId) -> bool
Unregister a hook.
Sourcepub fn unregister_widget(&mut self, widget_id: WidgetId)
pub fn unregister_widget(&mut self, widget_id: WidgetId)
Unregister all hooks for a widget.
Sourcepub fn emit(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
pub fn emit(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
Emit a lifecycle event immediately.
Sourcepub fn queue(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
pub fn queue(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
Queue a lifecycle event for later dispatch.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get the number of pending events.
Sourcepub fn hook_count(&self) -> usize
pub fn hook_count(&self) -> usize
Get the number of registered hooks.
Trait Implementations§
Source§impl Debug for LifecycleManager
impl Debug for LifecycleManager
Source§impl Default for LifecycleManager
impl Default for LifecycleManager
Source§fn default() -> LifecycleManager
fn default() -> LifecycleManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LifecycleManager
impl !RefUnwindSafe for LifecycleManager
impl Send for LifecycleManager
impl !Sync for LifecycleManager
impl Unpin for LifecycleManager
impl !UnwindSafe for LifecycleManager
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