pub struct HandlerCli { /* private fields */ }Expand description
Implementations§
Source§impl HandlerCli
impl HandlerCli
Sourcepub fn get(&self, name: &str) -> Option<Arc<dyn Handler>>
pub fn get(&self, name: &str) -> Option<Arc<dyn Handler>>
Returns the handler registered under the given verb, if any.
Sourcepub fn register<T, H>(&self, ctx: &Arc<T>, handler: H)
pub fn register<T, H>(&self, ctx: &Arc<T>, handler: H)
Registers a handler by value under its verb, if its
condition is met in the given context.
Sourcepub fn register_arc<T, H>(&self, ctx: &Arc<T>, handler: &Arc<H>)
pub fn register_arc<T, H>(&self, ctx: &Arc<T>, handler: &Arc<H>)
Registers an already-Arc-wrapped handler under its verb, if its
condition is met in the given context.
Sourcepub fn unregister(&self, name: &str) -> Option<Arc<dyn Handler>>
pub fn unregister(&self, name: &str) -> Option<Arc<dyn Handler>>
Removes and returns the handler registered under the given verb, if any.
Sourcepub async fn start<T>(&self, ctx: &Arc<T>) -> Result<()>
pub async fn start<T>(&self, ctx: &Arc<T>) -> Result<()>
Invokes Handler::start on every registered handler.
Sourcepub async fn stop<T>(&self, ctx: &Arc<T>) -> Result<()>
pub async fn stop<T>(&self, ctx: &Arc<T>) -> Result<()>
Invokes the stop lifecycle on every registered handler.
Trait Implementations§
Source§impl Default for HandlerCli
impl Default for HandlerCli
Source§fn default() -> HandlerCli
fn default() -> HandlerCli
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HandlerCli
impl RefUnwindSafe for HandlerCli
impl Send for HandlerCli
impl Sync for HandlerCli
impl Unpin for HandlerCli
impl UnsafeUnpin for HandlerCli
impl UnwindSafe for HandlerCli
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