[][src]Struct simple_irc::Message

pub struct Message {
    pub tags: BTreeMap<String, String>,
    pub prefix: Option<Prefix>,
    pub command: String,
    pub params: Vec<String>,
}

A structural representation of an IRC message.

Note that this library does not guarantee that messages will be preserved byte-for-byte, but all messages will have the same semantic meaning.

// use std::convert::FromStr;
let msg = "HELLO world".parse::<simple_irc::Message>().unwrap();
assert_eq!(msg.tags.len(), 0);
assert_eq!(msg.prefix, None);
assert_eq!(&msg.command[..], "HELLO");
assert_eq!(msg.params.len(), 1);
assert_eq!(&msg.params[0][..], "world");

assert_eq!(&msg.to_string(), "HELLO :world");

Fields

tags: BTreeMap<String, String>prefix: Option<Prefix>command: Stringparams: Vec<String>

Methods

impl Message[src]

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

pub fn new_with_all(
    tags: BTreeMap<String, String>,
    prefix: Option<Prefix>,
    command: String,
    params: Vec<String>
) -> Self
[src]

pub fn new_with_prefix(
    command: String,
    params: Vec<String>,
    prefix: Prefix
) -> Self
[src]

Trait Implementations

impl Clone for Message[src]

impl Debug for Message[src]

impl Default for Message[src]

impl Display for Message[src]

impl FromStr for Message[src]

type Err = Error

The associated error which can be returned from parsing.

impl PartialEq<Message> for Message[src]

impl StructuralPartialEq for Message[src]

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]

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, U> Into<U> for T where
    U: From<T>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.