Struct twitch_irc::message::IRCMessage
source · [−]pub struct IRCMessage {
pub tags: IRCTags,
pub prefix: Option<IRCPrefix>,
pub command: String,
pub params: Vec<String>,
}Expand description
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
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: StringA 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
sourceimpl IRCMessage
impl IRCMessage
sourcepub fn new_simple(command: String, params: Vec<String>) -> IRCMessage
pub fn new_simple(command: String, params: Vec<String>) -> IRCMessage
Create a new IRCMessage with just a command and parameters, similar to the
irc! macro.
sourcepub fn new(
tags: IRCTags,
prefix: Option<IRCPrefix>,
command: String,
params: Vec<String>
) -> IRCMessage
pub fn new(
tags: IRCTags,
prefix: Option<IRCPrefix>,
command: String,
params: Vec<String>
) -> IRCMessage
Create a new IRCMessage by specifying all fields.
sourcepub fn parse(source: &str) -> Result<IRCMessage, IRCParseError>
pub fn parse(source: &str) -> Result<IRCMessage, IRCParseError>
Parse a raw IRC wire-format message into an IRCMessage. source should be specified
without trailing newline character(s).
Trait Implementations
sourceimpl AsRawIRC for IRCMessage
impl AsRawIRC for IRCMessage
sourcefn format_as_raw_irc(&self, f: &mut Formatter<'_>) -> Result
fn format_as_raw_irc(&self, f: &mut Formatter<'_>) -> Result
sourcefn as_raw_irc(&self) -> Stringwhere
Self: Sized,
fn as_raw_irc(&self) -> Stringwhere
Self: Sized,
sourceimpl Clone for IRCMessage
impl Clone for IRCMessage
sourcefn clone(&self) -> IRCMessage
fn clone(&self) -> IRCMessage
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Debug for IRCMessage
impl Debug for IRCMessage
sourceimpl<'de> Deserialize<'de> for IRCMessage
impl<'de> Deserialize<'de> for IRCMessage
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl From<ClearChatMessage> for IRCMessage
impl From<ClearChatMessage> for IRCMessage
sourcefn from(msg: ClearChatMessage) -> IRCMessage
fn from(msg: ClearChatMessage) -> IRCMessage
sourceimpl From<ClearMsgMessage> for IRCMessage
impl From<ClearMsgMessage> for IRCMessage
sourcefn from(msg: ClearMsgMessage) -> IRCMessage
fn from(msg: ClearMsgMessage) -> IRCMessage
sourceimpl From<GlobalUserStateMessage> for IRCMessage
impl From<GlobalUserStateMessage> for IRCMessage
sourcefn from(msg: GlobalUserStateMessage) -> IRCMessage
fn from(msg: GlobalUserStateMessage) -> IRCMessage
sourceimpl From<JoinMessage> for IRCMessage
impl From<JoinMessage> for IRCMessage
sourcefn from(msg: JoinMessage) -> IRCMessage
fn from(msg: JoinMessage) -> IRCMessage
sourceimpl From<NoticeMessage> for IRCMessage
impl From<NoticeMessage> for IRCMessage
sourcefn from(msg: NoticeMessage) -> IRCMessage
fn from(msg: NoticeMessage) -> IRCMessage
sourceimpl From<PartMessage> for IRCMessage
impl From<PartMessage> for IRCMessage
sourcefn from(msg: PartMessage) -> IRCMessage
fn from(msg: PartMessage) -> IRCMessage
sourceimpl From<PingMessage> for IRCMessage
impl From<PingMessage> for IRCMessage
sourcefn from(msg: PingMessage) -> IRCMessage
fn from(msg: PingMessage) -> IRCMessage
sourceimpl From<PongMessage> for IRCMessage
impl From<PongMessage> for IRCMessage
sourcefn from(msg: PongMessage) -> IRCMessage
fn from(msg: PongMessage) -> IRCMessage
sourceimpl From<PrivmsgMessage> for IRCMessage
impl From<PrivmsgMessage> for IRCMessage
sourcefn from(msg: PrivmsgMessage) -> IRCMessage
fn from(msg: PrivmsgMessage) -> IRCMessage
sourceimpl From<ReconnectMessage> for IRCMessage
impl From<ReconnectMessage> for IRCMessage
sourcefn from(msg: ReconnectMessage) -> IRCMessage
fn from(msg: ReconnectMessage) -> IRCMessage
sourceimpl From<RoomStateMessage> for IRCMessage
impl From<RoomStateMessage> for IRCMessage
sourcefn from(msg: RoomStateMessage) -> IRCMessage
fn from(msg: RoomStateMessage) -> IRCMessage
sourceimpl From<ServerMessage> for IRCMessage
impl From<ServerMessage> for IRCMessage
sourcefn from(msg: ServerMessage) -> IRCMessage
fn from(msg: ServerMessage) -> IRCMessage
sourceimpl From<ServerMessageParseError> for IRCMessage
impl From<ServerMessageParseError> for IRCMessage
sourcefn from(msg: ServerMessageParseError) -> IRCMessage
fn from(msg: ServerMessageParseError) -> IRCMessage
sourceimpl From<UserNoticeMessage> for IRCMessage
impl From<UserNoticeMessage> for IRCMessage
sourcefn from(msg: UserNoticeMessage) -> IRCMessage
fn from(msg: UserNoticeMessage) -> IRCMessage
sourceimpl From<UserStateMessage> for IRCMessage
impl From<UserStateMessage> for IRCMessage
sourcefn from(msg: UserStateMessage) -> IRCMessage
fn from(msg: UserStateMessage) -> IRCMessage
sourceimpl From<WhisperMessage> for IRCMessage
impl From<WhisperMessage> for IRCMessage
sourcefn from(msg: WhisperMessage) -> IRCMessage
fn from(msg: WhisperMessage) -> IRCMessage
sourceimpl PartialEq<IRCMessage> for IRCMessage
impl PartialEq<IRCMessage> for IRCMessage
sourcefn eq(&self, other: &IRCMessage) -> bool
fn eq(&self, other: &IRCMessage) -> bool
sourceimpl Serialize for IRCMessage
impl Serialize for IRCMessage
sourceimpl TryFrom<IRCMessage> for ClearChatMessage
impl TryFrom<IRCMessage> for ClearChatMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<ClearChatMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<ClearChatMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for ClearMsgMessage
impl TryFrom<IRCMessage> for ClearMsgMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<ClearMsgMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<ClearMsgMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for GlobalUserStateMessage
impl TryFrom<IRCMessage> for GlobalUserStateMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<GlobalUserStateMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<GlobalUserStateMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for JoinMessage
impl TryFrom<IRCMessage> for JoinMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(source: IRCMessage) -> Result<JoinMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<JoinMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for NoticeMessage
impl TryFrom<IRCMessage> for NoticeMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<NoticeMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<NoticeMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for PartMessage
impl TryFrom<IRCMessage> for PartMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(source: IRCMessage) -> Result<PartMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<PartMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for PingMessage
impl TryFrom<IRCMessage> for PingMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(source: IRCMessage) -> Result<PingMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<PingMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for PongMessage
impl TryFrom<IRCMessage> for PongMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(source: IRCMessage) -> Result<PongMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<PongMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for PrivmsgMessage
impl TryFrom<IRCMessage> for PrivmsgMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<PrivmsgMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<PrivmsgMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for ReconnectMessage
impl TryFrom<IRCMessage> for ReconnectMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<ReconnectMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<ReconnectMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for RoomStateMessage
impl TryFrom<IRCMessage> for RoomStateMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<RoomStateMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<RoomStateMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for ServerMessage
impl TryFrom<IRCMessage> for ServerMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<ServerMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<ServerMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for UserNoticeMessage
impl TryFrom<IRCMessage> for UserNoticeMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<UserNoticeMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<UserNoticeMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for UserStateMessage
impl TryFrom<IRCMessage> for UserStateMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<UserStateMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<UserStateMessage, ServerMessageParseError>
sourceimpl TryFrom<IRCMessage> for WhisperMessage
impl TryFrom<IRCMessage> for WhisperMessage
type Error = ServerMessageParseError
type Error = ServerMessageParseError
sourcefn try_from(
source: IRCMessage
) -> Result<WhisperMessage, ServerMessageParseError>
fn try_from(
source: IRCMessage
) -> Result<WhisperMessage, ServerMessageParseError>
impl Eq for IRCMessage
impl StructuralEq for IRCMessage
impl StructuralPartialEq for IRCMessage
Auto Trait Implementations
impl RefUnwindSafe for IRCMessage
impl Send for IRCMessage
impl Sync for IRCMessage
impl Unpin for IRCMessage
impl UnwindSafe for IRCMessage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.