Macro twitch_irc::irc

source ·
macro_rules! irc {
    (@replace_expr $_t:tt $sub:expr) => { ... };
    (@count_exprs $($expression:expr),*) => { ... };
    ($command:expr $(, $argument:expr )* ) => { ... };
}
Expand description

Allows quick creation of simple IRC messages using a command and optional parameters.

The given command and parameters have to implement From<T> for String if they are not already of type String.

Example

use twitch_irc::irc;
use twitch_irc::message::AsRawIRC;

let msg = irc!["PRIVMSG", "#sodapoppin", "Hello guys!"];

assert_eq!(msg.command, "PRIVMSG");
assert_eq!(msg.params, vec!["#sodapoppin".to_owned(), "Hello guys!".to_owned()]);
assert_eq!(msg.as_raw_irc(), "PRIVMSG #sodapoppin :Hello guys!");