macro_rules! command_match {
(@message=$message:expr => $command:pat => $body:expr) => { ... };
(@message=$message:expr => $command:pat => $body:expr, $($rest:tt)*) => { ... };
($message:expr => { $($rest:tt)* }) => { ... };
}
Expand description
A macro for simplifying the process of matching commands.
ยงExamples
Match all PING commands.
command_match! {
msg => {
Ping(source) => println!("{}", source),
_ => ()
}
};