pub struct Message {
pub tags: BTreeMap<String, String>,
pub prefix: Option<Prefix>,
pub command: String,
pub params: Vec<String>,
}
Expand description
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§
§prefix: Option<Prefix>
§command: String
§params: Vec<String>
Implementations§
Trait Implementations§
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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