Macro pircolate::command_match [] [src]

macro_rules! command_match {
    (@message=$message:expr => $command:pat => $body:expr) => { ... };
    (@message=$message:expr => $command:pat => $body:expr, $($rest:tt)*) => { ... };
    ($message:expr => { $($rest:tt)* }) => { ... };
}

A macro for simplifying the process of matching commands.

Examples

Match all PING commands.

command_match! {
    msg => {
        Ping(source) => println!("{}", source),
        _ => ()
    }
};