pub struct CallbackRegistry { /* private fields */ }Expand description
Registry for timer event callbacks.
Provides shared callback registration and retrieval logic used by both
TestClock and LiveClock.
Implementations§
Source§impl CallbackRegistry
impl CallbackRegistry
Sourcepub fn register_default_handler(&mut self, callback: TimeEventCallback)
pub fn register_default_handler(&mut self, callback: TimeEventCallback)
Registers the callback used when no callback exists for a timer name.
Sourcepub fn cancel_default_handler(&mut self)
pub fn cancel_default_handler(&mut self)
Removes the default callback, preserving all named callbacks.
Sourcepub fn register_callback(&mut self, name: Ustr, callback: TimeEventCallback)
pub fn register_callback(&mut self, name: Ustr, callback: TimeEventCallback)
Registers a callback for name, replacing any existing callback for that name.
Sourcepub fn has_any_callback(&self, name: &Ustr) -> bool
pub fn has_any_callback(&self, name: &Ustr) -> bool
Returns whether a named or default callback is available for name.
Sourcepub fn get_callback(&self, name: &Ustr) -> Option<TimeEventCallback>
pub fn get_callback(&self, name: &Ustr) -> Option<TimeEventCallback>
Returns the callback for name, falling back to the default callback.
Sourcepub fn get_handler(&self, event: TimeEvent) -> TimeEventHandler
pub fn get_handler(&self, event: TimeEvent) -> TimeEventHandler
Creates a handler for event using its named callback or the default callback.
§Panics
Panics if neither a named nor default callback exists for the event.
Trait Implementations§
Source§impl Debug for CallbackRegistry
impl Debug for CallbackRegistry
Source§impl Default for CallbackRegistry
impl Default for CallbackRegistry
Source§fn default() -> CallbackRegistry
fn default() -> CallbackRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for CallbackRegistry
impl !Send for CallbackRegistry
impl !Sync for CallbackRegistry
impl !UnwindSafe for CallbackRegistry
impl Freeze for CallbackRegistry
impl Unpin for CallbackRegistry
impl UnsafeUnpin for CallbackRegistry
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