1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::borrow::Cow;
use std::fmt;

#[derive(Debug)]
pub enum Reaction {
    None,
    Msg(Cow<'static, str>),
    Msgs(Cow<'static, [Cow<'static, str>]>),
    Reply(Cow<'static, str>),
    Replies(Cow<'static, [Cow<'static, str>]>),
    RawMsg(Cow<'static, str>),
    Quit(Option<Cow<'static, str>>),
}

#[derive(Debug)]
pub enum ErrorReaction {
    Proceed,
    Quit(Option<Cow<'static, str>>),
}

/// Copied from `yak-irc`'s `Reaction`.
#[derive(Clone, Debug)]
pub enum LibReaction<Msg>
where
    Msg: Clone + fmt::Debug,
{
    /// React by sending an IRC message. No line-wrapping or other formatting will be performed on
    /// the message, except that the message-terminating sequence of a carriage return character
    /// and a line feed character ("CR-LF") will be appended. If the message exceeds 512 octets in
    /// length (including the terminating CR-LF sequence, but excluding any IRCv3 message tags), it
    /// may be truncated to 512 octets.
    RawMsg(Msg),

    /// Return multiple reactions, which will be processed in the order given.
    Multi(Vec<LibReaction<Msg>>),
}