Skip to main content

CommandHandler

Trait CommandHandler 

Source
pub trait CommandHandler: Send + Sync {
    // Required methods
    fn command_name(&self) -> CommandName;
    fn handle(
        &self,
        command: &CommandEnvelope,
        context: &dyn RuntimeContext,
    ) -> RuntimeResult<CommandResult>;
}
Expand description

Command handler contract.

Required Methods§

Source

fn command_name(&self) -> CommandName

Returns the command name handled by this implementation.

Source

fn handle( &self, command: &CommandEnvelope, context: &dyn RuntimeContext, ) -> RuntimeResult<CommandResult>

Handles one validated command in a read-only Runtime context.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§