Trait Handler

Source
pub trait Handler:
    Sync
    + Send
    + AnySync {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        self: Arc<Self>,
        ctx: &'life0 Arc<dyn Context>,
        argv: Vec<String>,
        cmd: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn verb(&self, _ctx: &Arc<dyn Context>) -> Option<&'static str> { ... }
    fn condition(&self, ctx: &Arc<dyn Context>) -> bool { ... }
    fn help(&self, _ctx: &Arc<dyn Context>) -> &'static str { ... }
    fn dyn_help(&self, _ctx: &Arc<dyn Context>) -> String { ... }
    fn complete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 Arc<dyn Context>,
        _cmd: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<String>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn start<'life0, 'async_trait>(
        self: Arc<Self>,
        _ctx: &'life0 Arc<dyn Context>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn stop<'life0, 'async_trait>(
        self: Arc<Self>,
        _ctx: &'life0 Arc<dyn Context>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( self: Arc<Self>, ctx: &'life0 Arc<dyn Context>, argv: Vec<String>, cmd: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn verb(&self, _ctx: &Arc<dyn Context>) -> Option<&'static str>

Source

fn condition(&self, ctx: &Arc<dyn Context>) -> bool

Source

fn help(&self, _ctx: &Arc<dyn Context>) -> &'static str

Source

fn dyn_help(&self, _ctx: &Arc<dyn Context>) -> String

Source

fn complete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 Arc<dyn Context>, _cmd: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<String>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn start<'life0, 'async_trait>( self: Arc<Self>, _ctx: &'life0 Arc<dyn Context>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn stop<'life0, 'async_trait>( self: Arc<Self>, _ctx: &'life0 Arc<dyn Context>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementations§

Source§

impl dyn Handler

Source

pub fn is<_T>(&self) -> bool
where _T: Any, Self: Downcast<_T>,

Source

pub fn downcast_ref<_T>(&self) -> Result<&_T, TypeMismatch>
where _T: Any, Self: Downcast<_T>,

Source

pub fn downcast_mut<_T>(&mut self) -> Result<&mut _T, TypeMismatch>
where _T: Any, Self: Downcast<_T>,

Source

pub fn downcast<_T>( self: Box<Self>, ) -> Result<Box<_T>, DowncastError<Box<Self>>>
where _T: Any, Self: Downcast<_T>,

Source

pub fn downcast_rc<_T>( self: Rc<Self>, ) -> Result<Rc<_T>, DowncastError<Rc<Self>>>
where _T: Any, Self: Downcast<_T>,

Source

pub fn downcast_arc<_T>( self: Arc<Self>, ) -> Result<Arc<_T>, DowncastError<Arc<Self>>>
where _T: AnySync, Self: DowncastSync<_T>,

Trait Implementations§

Source§

impl<_T> Downcast<_T> for dyn Handler
where _T: Any,

Source§

impl<_T> DowncastSync<_T> for dyn Handler
where _T: AnySync,

Source§

fn downcast_arc(self: Arc<Self>) -> Result<Arc<T>, DowncastError<Arc<Self>>>

Implementors§