pub struct LifecycleManager { /* private fields */ }Expand description
Manager for widget lifecycle hooks.
Implementations§
Source§impl LifecycleManager
impl LifecycleManager
Sourcepub fn register(
&mut self,
widget_id: WidgetId,
phases: Vec<LifecyclePhase>,
callback: LifecycleCallback,
) -> HookId
pub fn register( &mut self, widget_id: WidgetId, phases: Vec<LifecyclePhase>, callback: LifecycleCallback, ) -> 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: LifecycleCallback,
) -> HookId
pub fn on_mount( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register a mount hook.
Sourcepub fn on_unmount(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_unmount( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register an unmount hook.
Sourcepub fn on_update(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_update( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register an update hook.
Sourcepub fn on_focus(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_focus( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register a focus hook.
Sourcepub fn on_blur(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_blur( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> 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
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().