[][src]Enum tmi_parser::Message

pub enum Message<'a> {
    Ping,
    Pong,
    CapReq {
        req: &'a str,
    },
    CapAck {
        req: &'a str,
    },
    Pass {
        pass: &'a str,
    },
    Nick {
        nick: &'a str,
    },
    Join {
        chan: &'a str,
    },
    Part {
        chan: &'a str,
    },
    Privmsg {
        tags: Option<Tags<'a>>,
        chan: &'a str,
        msg: &'a str,
    },
    Clearchat {
        tags: Option<Tags<'a>>,
        chan: &'a str,
        usr: Option<&'a str>,
    },
    Clearmsg {
        tags: Option<Tags<'a>>,
        chan: &'a str,
        msg: &'a str,
    },
    HosttargetStart {
        host: &'a str,
        chan: &'a str,
        view: Option<u32>,
    },
    HosttargetEnd {
        host: &'a str,
        view: Option<u32>,
    },
    Notice {
        tags: Option<Tags<'a>>,
        chan: &'a str,
        msg: &'a str,
    },
    Reconnect,
    Roomstate {
        tags: Option<Tags<'a>>,
        chan: &'a str,
    },
    Usernotice {
        tags: Option<Tags<'a>>,
        chan: &'a str,
        msg: &'a str,
    },
    Userstate {
        tags: Option<Tags<'a>>,
        chan: &'a str,
    },
    GlobalUserstate {
        tags: Option<Tags<'a>>,
    },
}

Possible types of TMI messages. Unrecognized messages are handled by the associated [parse] function.

Tags are always treated as Optional even on messages that require them. Actually, tags validation should be done by the user code.

Consider changing simple enum structs to enum tuples.

Variants

Ping

Represents a ping request message. PING :<endpoint>

Pong

Represents a pong response message. PONG :<endpoint>

CapReq

Represents a capability request message. CAP REQ :<capability>

Fields of CapReq

req: &'a str
CapAck

Represents a capability acknowledgement message. :<endpoint> CAP * ACK :<capability>

Fields of CapAck

req: &'a str
Pass

Represents a password authentication message. PASS <password> PASS oauth:<token> (using Twitch OAuth tokens)

Fields of Pass

pass: &'a str
Nick

Represents a nickname authentication message. NICK <user>

Fields of Nick

nick: &'a str
Join

Represents a join command message. JOIN #<channel>

Fields of Join

chan: &'a str
Part

Represents a part command message. PART #<channel>

Fields of Part

chan: &'a str
Privmsg

Represents a privmsg command message. [@<tags>] PRIVMSG #<channel> :<message>

Fields of Privmsg

tags: Option<Tags<'a>>chan: &'a strmsg: &'a str
Clearchat

Represents a clearchat command message. [@<tags>] :<endpoint> CLEARCHAT #<channel> [:<user>]

Fields of Clearchat

tags: Option<Tags<'a>>chan: &'a strusr: Option<&'a str>
Clearmsg

Represents a clearmsg command message. [@<tags>] :<endpoint> CLEARMSG #<channel> [:<message>]

Fields of Clearmsg

tags: Option<Tags<'a>>chan: &'a strmsg: &'a str
HosttargetStart

Represents a hosttarget start message. :<endpoint> HOSTTARGET #<host> :<channel> [<viewers>]

Fields of HosttargetStart

host: &'a strchan: &'a strview: Option<u32>
HosttargetEnd

Represents a hosttarget end message. :<endpoint> HOSTTARGET #<host> :- [<viewers>]

Fields of HosttargetEnd

host: &'a strview: Option<u32>
Notice

Represents a notice message. [@<tags>] :<endpoint> NOTICE #<channel> :<message>

Fields of Notice

tags: Option<Tags<'a>>chan: &'a strmsg: &'a str
Reconnect

Represents a reconnect request message. RECONNECT

Roomstate

Represents a roomstate message. [@<tags>] :<endpoint> ROOMSTATE #<channel>

Fields of Roomstate

tags: Option<Tags<'a>>chan: &'a str
Usernotice

Represents a usernotice message. [@<tags>] :<endpoint> USERNOTICE #<channel> :<message>

Fields of Usernotice

tags: Option<Tags<'a>>chan: &'a strmsg: &'a str
Userstate

Represents a userstate message. [@<tags>] :<endpoint> USERSTATE #<channel>

Fields of Userstate

tags: Option<Tags<'a>>chan: &'a str
GlobalUserstate

Represents a global userstate message. [@<tags>] :<endpoint> GLOBALUSERSTATE

Fields of GlobalUserstate

tags: Option<Tags<'a>>

Implementations

impl<'a> Message<'a>[src]

pub fn parse(msg: &'a str) -> Result<Message<'_>>[src]

Parses a [& str] slice and returns a Message if successful, otherwise an [io::Error].

Examples

let s = ":tmi.twitch.tv CLEARCHAT #dallas :ronni";
let msg = tmi_parser::Message::parse(s);

Trait Implementations

impl<'a> Debug for Message<'a>[src]

impl<'a> PartialEq<Message<'a>> for Message<'a>[src]

impl<'a> StructuralPartialEq for Message<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Message<'a>[src]

impl<'a> Send for Message<'a>[src]

impl<'a> Sync for Message<'a>[src]

impl<'a> Unpin for Message<'a>[src]

impl<'a> UnwindSafe for Message<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.