Skip to main content

ICommand

Trait ICommand 

Source
pub trait ICommand<H: IHandler, S: ISuccess, F: IFailure>:
    Display
    + Send
    + Sync {
    // Required methods
    fn new<T: Executable + Send + Sync + 'static>(
        request: T,
        handler: H,
    ) -> Self;
    fn execute<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<S, F>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

A command that pairs a request with its handler for execution.

Required Methods§

Source

fn new<T: Executable + Send + Sync + 'static>(request: T, handler: H) -> Self

Create a command from a request and its matched handler.

Source

fn execute<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<S, F>> + Send + 'async_trait>>
where Self: 'async_trait,

Execute the command and return the result.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§