[−][src]Struct irc_rust::message::Message
A simple irc message containing tags, prefix, command, parameters and a trailing parameter.
Examples
use irc_rust::message::Message; let message = Message::from("@key1=value1;key2=value2 :name!user@host CMD param1 param2 :trailing"); assert_eq!(message.to_string(), "@key1=value1;key2=value2 :name!user@host CMD param1 param2 :trailing");
use irc_rust::message::Message; let message = Message::builder() .tag("key1", "value1") .tag("key2", "value2") .prefix_name("name") .prefix_user("user") .prefix_host("host") .command("CMD") .param("param1").param("param2") .trailing("trailing") .build(); let tags = message.tags().unwrap(); println!("key1={}", &tags["key1"]) // Prints 'key1=value1'
Methods
impl Message
[src]
pub fn new(raw: String) -> Message
[src]
Create a new Message from the given string. Expects the string to be in a valid irc format.
pub fn from(raw: &str) -> Message
[src]
pub fn builder<'a>() -> MessageBuilder<'a>
[src]
Creates a message builder as alternative to building an irc string before creating the message.
pub fn tags(&self) -> Option<Tags>
[src]
Returns tags if any are present.
pub fn prefix(&self) -> Option<Prefix>
[src]
Returns the Prefix if present.
pub fn command(&self) -> &str
[src]
Returns the command the message represents.
pub fn params(&self) -> Option<Params>
[src]
Returns the params if any are present.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,