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.
 

15 lines
489 B

use std::io;
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<Message> {
/// Attempts to handle the given message against the given context.
fn run(self, context: &Context, message: &Message) -> io::Result<()>;
/// Returns the name of this handler type.
fn name() -> String;
}