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: 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§
Source§impl 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§
Source§impl AsRawIRC for IRCMessage
impl AsRawIRC for IRCMessage
Source§impl Clone for IRCMessage
impl Clone for IRCMessage
Source§fn clone(&self) -> IRCMessage
fn clone(&self) -> IRCMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for IRCMessage
impl Debug for IRCMessage
Source§impl<'de> Deserialize<'de> for IRCMessage
impl<'de> Deserialize<'de> for IRCMessage
Source§fn 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>,
Source§impl From<ClearChatMessage> for IRCMessage
impl From<ClearChatMessage> for IRCMessage
Source§fn from(msg: ClearChatMessage) -> IRCMessage
fn from(msg: ClearChatMessage) -> IRCMessage
Source§impl From<ClearMsgMessage> for IRCMessage
impl From<ClearMsgMessage> for IRCMessage
Source§fn from(msg: ClearMsgMessage) -> IRCMessage
fn from(msg: ClearMsgMessage) -> IRCMessage
Source§impl From<GlobalUserStateMessage> for IRCMessage
impl From<GlobalUserStateMessage> for IRCMessage
Source§fn from(msg: GlobalUserStateMessage) -> IRCMessage
fn from(msg: GlobalUserStateMessage) -> IRCMessage
Source§impl From<JoinMessage> for IRCMessage
impl From<JoinMessage> for IRCMessage
Source§fn from(msg: JoinMessage) -> IRCMessage
fn from(msg: JoinMessage) -> IRCMessage
Source§impl From<NoticeMessage> for IRCMessage
impl From<NoticeMessage> for IRCMessage
Source§fn from(msg: NoticeMessage) -> IRCMessage
fn from(msg: NoticeMessage) -> IRCMessage
Source§impl From<PartMessage> for IRCMessage
impl From<PartMessage> for IRCMessage
Source§fn from(msg: PartMessage) -> IRCMessage
fn from(msg: PartMessage) -> IRCMessage
Source§impl From<PingMessage> for IRCMessage
impl From<PingMessage> for IRCMessage
Source§fn from(msg: PingMessage) -> IRCMessage
fn from(msg: PingMessage) -> IRCMessage
Source§impl From<PongMessage> for IRCMessage
impl From<PongMessage> for IRCMessage
Source§fn from(msg: PongMessage) -> IRCMessage
fn from(msg: PongMessage) -> IRCMessage
Source§impl From<PrivmsgMessage> for IRCMessage
impl From<PrivmsgMessage> for IRCMessage
Source§fn from(msg: PrivmsgMessage) -> IRCMessage
fn from(msg: PrivmsgMessage) -> IRCMessage
Source§impl From<ReconnectMessage> for IRCMessage
impl From<ReconnectMessage> for IRCMessage
Source§fn from(msg: ReconnectMessage) -> IRCMessage
fn from(msg: ReconnectMessage) -> IRCMessage
Source§impl From<RoomStateMessage> for IRCMessage
impl From<RoomStateMessage> for IRCMessage
Source§fn from(msg: RoomStateMessage) -> IRCMessage
fn from(msg: RoomStateMessage) -> IRCMessage
Source§impl From<ServerMessage> for IRCMessage
impl From<ServerMessage> for IRCMessage
Source§fn from(msg: ServerMessage) -> IRCMessage
fn from(msg: ServerMessage) -> IRCMessage
Source§impl From<ServerMessageParseError> for IRCMessage
impl From<ServerMessageParseError> for IRCMessage
Source§fn from(msg: ServerMessageParseError) -> IRCMessage
fn from(msg: ServerMessageParseError) -> IRCMessage
Source§impl From<UserNoticeMessage> for IRCMessage
impl From<UserNoticeMessage> for IRCMessage
Source§fn from(msg: UserNoticeMessage) -> IRCMessage
fn from(msg: UserNoticeMessage) -> IRCMessage
Source§impl From<UserStateMessage> for IRCMessage
impl From<UserStateMessage> for IRCMessage
Source§fn from(msg: UserStateMessage) -> IRCMessage
fn from(msg: UserStateMessage) -> IRCMessage
Source§impl From<WhisperMessage> for IRCMessage
impl From<WhisperMessage> for IRCMessage
Source§fn from(msg: WhisperMessage) -> IRCMessage
fn from(msg: WhisperMessage) -> IRCMessage
Source§impl PartialEq for IRCMessage
impl PartialEq for IRCMessage
Source§impl Serialize for IRCMessage
impl Serialize for IRCMessage
Source§impl TryFrom<IRCMessage> for ClearChatMessage
impl TryFrom<IRCMessage> for ClearChatMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<ClearChatMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<ClearChatMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for ClearMsgMessage
impl TryFrom<IRCMessage> for ClearMsgMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<ClearMsgMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<ClearMsgMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for GlobalUserStateMessage
impl TryFrom<IRCMessage> for GlobalUserStateMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<GlobalUserStateMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<GlobalUserStateMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for JoinMessage
impl TryFrom<IRCMessage> for JoinMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(source: IRCMessage) -> Result<JoinMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<JoinMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for NoticeMessage
impl TryFrom<IRCMessage> for NoticeMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<NoticeMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<NoticeMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for PartMessage
impl TryFrom<IRCMessage> for PartMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(source: IRCMessage) -> Result<PartMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<PartMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for PingMessage
impl TryFrom<IRCMessage> for PingMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(source: IRCMessage) -> Result<PingMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<PingMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for PongMessage
impl TryFrom<IRCMessage> for PongMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(source: IRCMessage) -> Result<PongMessage, ServerMessageParseError>
fn try_from(source: IRCMessage) -> Result<PongMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for PrivmsgMessage
impl TryFrom<IRCMessage> for PrivmsgMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<PrivmsgMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<PrivmsgMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for ReconnectMessage
impl TryFrom<IRCMessage> for ReconnectMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<ReconnectMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<ReconnectMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for RoomStateMessage
impl TryFrom<IRCMessage> for RoomStateMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<RoomStateMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<RoomStateMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for ServerMessage
impl TryFrom<IRCMessage> for ServerMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<ServerMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<ServerMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for UserNoticeMessage
impl TryFrom<IRCMessage> for UserNoticeMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<UserNoticeMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<UserNoticeMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for UserStateMessage
impl TryFrom<IRCMessage> for UserStateMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<UserStateMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<UserStateMessage, ServerMessageParseError>
Source§impl TryFrom<IRCMessage> for WhisperMessage
impl TryFrom<IRCMessage> for WhisperMessage
Source§type Error = ServerMessageParseError
type Error = ServerMessageParseError
Source§fn try_from(
source: IRCMessage,
) -> Result<WhisperMessage, ServerMessageParseError>
fn try_from( source: IRCMessage, ) -> Result<WhisperMessage, ServerMessageParseError>
impl Eq for IRCMessage
impl StructuralPartialEq for IRCMessage
Auto Trait Implementations§
impl Freeze for IRCMessage
impl RefUnwindSafe for IRCMessage
impl Send for IRCMessage
impl Sync for IRCMessage
impl Unpin for IRCMessage
impl UnwindSafe for IRCMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more