[][src]Struct twitch_irc::message::IRCMessage

pub struct IRCMessage {
    pub tags: IRCTags,
    pub prefix: Option<IRCPrefix>,
    pub command: String,
    pub params: Vec<String>,
}

A protocol-level IRC message, with arbitrary command, parameters, tags and prefix.

See RFC 2812, section 2.3.1 for the message format that this is based on. Further, this implements IRCv3 tags.

Fields

tags: IRCTags

A map of additional key-value tags on this message.

prefix: Option<IRCPrefix>

The "prefix" of this message, as defined by RFC 2812. Typically specifies the sending server and/or user.

command: String

A command like PRIVMSG or 001 (see RFC 2812 for the definition).

params: Vec<String>

A list of parameters on this IRC message. See RFC 2812 for the definition.

Middle parameters and trailing parameters are treated the same here, and as long as there are no spaces in the last parameter, there is no way to tell if that parameter was a middle or trailing parameter when it was parsed.

Implementations

impl IRCMessage[src]

pub fn new_simple(command: String, params: Vec<String>) -> IRCMessage[src]

Create a new IRCMessage with just a command and parameters, similar to the irc! macro.

pub fn new(
    tags: IRCTags,
    prefix: Option<IRCPrefix>,
    command: String,
    params: Vec<String>
) -> IRCMessage
[src]

Create a new IRCMessage by specifying all fields.

pub fn parse(mut source: &str) -> Result<IRCMessage, IRCParseError>[src]

Parse a raw IRC wire-format message into an IRCMessage. source should be specified without trailing newline character(s).

Trait Implementations

impl AsRawIRC for IRCMessage[src]

impl Clone for IRCMessage[src]

impl Debug for IRCMessage[src]

impl From<ClearChatMessage> for IRCMessage[src]

impl From<ClearMsgMessage> for IRCMessage[src]

impl From<GlobalUserStateMessage> for IRCMessage[src]

impl From<HostTargetMessage> for IRCMessage[src]

impl From<JoinMessage> for IRCMessage[src]

impl From<NoticeMessage> for IRCMessage[src]

impl From<PartMessage> for IRCMessage[src]

impl From<PingMessage> for IRCMessage[src]

impl From<PongMessage> for IRCMessage[src]

impl From<PrivmsgMessage> for IRCMessage[src]

impl From<ReconnectMessage> for IRCMessage[src]

impl From<RoomStateMessage> for IRCMessage[src]

impl From<ServerMessage> for IRCMessage[src]

impl From<ServerMessageParseError> for IRCMessage[src]

impl From<UserNoticeMessage> for IRCMessage[src]

impl From<UserStateMessage> for IRCMessage[src]

impl From<WhisperMessage> for IRCMessage[src]

impl PartialEq<IRCMessage> for IRCMessage[src]

impl StructuralPartialEq for IRCMessage[src]

impl TryFrom<IRCMessage> for ClearChatMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for ClearMsgMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for ReconnectMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for RoomStateMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for UserNoticeMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for UserStateMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for WhisperMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for ServerMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for GlobalUserStateMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for HostTargetMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for JoinMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for NoticeMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for PartMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for PingMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for PongMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

impl TryFrom<IRCMessage> for PrivmsgMessage[src]

type Error = ServerMessageParseError

The type returned in the event of a conversion error.

Auto Trait Implementations

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> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,