pub struct Message {
pub source: Option<String>,
pub command: IRCCommand,
pub params: Vec<String>,
}
Fields§
§source: Option<String>
§command: IRCCommand
§params: Vec<String>
Implementations§
Source§impl Message
impl Message
Sourcepub fn serialize(&self) -> Vec<u8> ⓘ
pub fn serialize(&self) -> Vec<u8> ⓘ
Returns the serialize of this Message
.
Will truncate output to 510 characters and then include CR (13) and LF (10) suffix as per RFC 2812
Sourcepub fn parse(
raw_input: Vec<u8>,
source_client: Option<String>,
) -> Result<Self, MessageError>
pub fn parse( raw_input: Vec<u8>, source_client: Option<String>, ) -> Result<Self, MessageError>
From a u8 vector representing an IRC message will return a Message
, will not validate presence of CRLF but will strip them before processing. An optional client prefix can be provided to override or represent the source of the IRC message.
§Errors
This function will return an error if the provided message is not a valid IRC message as per RFC 2812, including presence of no data, invalid commands and missing mandatory parameters.
Trait Implementations§
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