pub struct CommandHandlerStore { /* private fields */ }Expand description
Store for command handlers registered by modules.
Modules register their handlers during init() by calling add().
After all modules are initialized, the runner extracts handlers
via take_handlers().
§Thread Safety
Uses RwLock for interior mutability, allowing modules to register
handlers concurrently if needed.
Implementations§
Source§impl CommandHandlerStore
impl CommandHandlerStore
Sourcepub fn add(&self, handler: Box<dyn CommandHandler>)
pub fn add(&self, handler: Box<dyn CommandHandler>)
Add a command handler to the store.
Called by modules during init().
§Panics
Panics if the lock is poisoned.
Sourcepub fn add_arc(&self, handler: Arc<dyn CommandHandler>)
pub fn add_arc(&self, handler: Arc<dyn CommandHandler>)
Sourcepub fn take_handlers(&self) -> Vec<Arc<dyn CommandHandler>>
pub fn take_handlers(&self) -> Vec<Arc<dyn CommandHandler>>
Take all handlers, clearing the store.
Called by runner after all modules are initialized.
§Panics
Panics if the lock is poisoned.
Trait Implementations§
Source§impl Debug for CommandHandlerStore
impl Debug for CommandHandlerStore
Source§impl Default for CommandHandlerStore
impl Default for CommandHandlerStore
impl Service for CommandHandlerStore
Auto Trait Implementations§
impl !Freeze for CommandHandlerStore
impl RefUnwindSafe for CommandHandlerStore
impl Send for CommandHandlerStore
impl Sync for CommandHandlerStore
impl Unpin for CommandHandlerStore
impl UnsafeUnpin for CommandHandlerStore
impl UnwindSafe for CommandHandlerStore
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