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§
Sourcefn command_name(&self) -> CommandName
fn command_name(&self) -> CommandName
Returns the command name handled by this implementation.
Sourcefn handle(
&self,
command: &CommandEnvelope,
context: &dyn RuntimeContext,
) -> RuntimeResult<CommandResult>
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".