Solstice client.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

21 lines
535 B

use std::fmt::Debug;
use crate::context::Context;
/// A trait for types that can handle reception of a message.
///
/// Message types are mapped to handler types by Dispatcher.
/// This trait is intended to allow composing handler logic.
pub trait MessageHandler: Debug {
type Message;
/// Attempts to handle the given message against the given context.
fn run(
self,
context: &mut Context,
message: &Self::Message,
) -> anyhow::Result<()>;
/// Returns the name of this handler type.
fn name() -> String;
}