pub struct IrcMessage {
pub tags: HashMap<String, Option<String>>,
pub prefix: Option<String>,
pub command: String,
pub params: Vec<String>,
}Expand description
An IRC message with optional tags, prefix, command, and parameters
Fieldsยง
Message tags (IRCv3)
prefix: Option<String>Message prefix (source)
command: StringIRC command
params: Vec<String>Command parameters
Implementationsยง
Sourceยงimpl IrcMessage
impl IrcMessage
Sourcepub fn with_params(self, params: Vec<String>) -> Self
pub fn with_params(self, params: Vec<String>) -> Self
Add parameters to the message
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Add a prefix to the message
Sourcepub fn with_tag(self, key: impl Into<String>, value: Option<String>) -> Self
pub fn with_tag(self, key: impl Into<String>, value: Option<String>) -> Self
Add a tag to the message
Add multiple tags to the message
Sourcepub fn get_timestamp(&self) -> SystemTime
pub fn get_timestamp(&self) -> SystemTime
Extract server timestamp from message tags, fallback to current time
Sourcepub fn get_account(&self) -> Option<&str>
pub fn get_account(&self) -> Option<&str>
Get the account tag (if present)
Sourcepub fn is_message(&self) -> bool
pub fn is_message(&self) -> bool
Check if this is a PRIVMSG or NOTICE
Sourcepub fn is_channel_message(&self) -> bool
pub fn is_channel_message(&self) -> bool
Check if this is a channel message (target starts with # or &)
Trait Implementationsยง
Sourceยงimpl Clone for IrcMessage
impl Clone for IrcMessage
Sourceยงfn clone(&self) -> IrcMessage
fn clone(&self) -> IrcMessage
Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
Sourceยงimpl Display for IrcMessage
impl Display for IrcMessage
Sourceยงimpl From<Reply> for IrcMessage
impl From<Reply> for IrcMessage
Sourceยงimpl FromStr for IrcMessage
impl FromStr for IrcMessage
Sourceยงimpl PartialEq for IrcMessage
impl PartialEq for IrcMessage
Sourceยงimpl Serialize for IrcMessage
impl Serialize 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 UnsafeUnpin 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
Mutably borrows from an owned value. Read more