[−][src]Struct ellidri::message::MessageBuffer
Helper to build an IRC message.
Created by Buffer::message
and Buffer::message
.
Methods
impl<'a> MessageBuffer<'a>
[src]
pub fn param(self, param: &str) -> Self
[src]
Appends a parameter to the message.
The parameter is trimmed before insertion. If param
is whitespace, it is not appended.
Note: It is up to the caller to make sure there is no remaning whitespace or newline in the parameter.
Example
let mut response = Buffer::new(); response.message("nick!user@127.0.0.1", Command::Quit) .param(" chiao "); assert_eq!(&response.build(), ":nick!user@127.0.0.1 QUIT chiao\r\n");
pub fn trailing_param(self, param: &str)
[src]
Appends the traililng parameter to the message and consumes the buffer.
Contrary to MessageBuffer::param
, the parameter is not trimmed before insertion. Even if
param
is whitespace, it is not appended.
Note: It is up to the caller to make sure there is no newline in the parameter.
Example
let mut response = Buffer::new(); response.message("nick!user@127.0.0.1", Command::Quit) .trailing_param("long quit message"); assert_eq!(&response.build(), ":nick!user@127.0.0.1 QUIT :long quit message\r\n");
pub fn raw_param(&mut self) -> &mut String
[src]
Returns a buffer the caller can use to append characters to an IRC message.
Example
let mut response = Buffer::new(); { let mut msg = response.message("nick!user@127.0.0.1", Command::Mode) .param("#my_channel"); let mut param = msg.raw_param(); param.push('+'); param.push('n'); param.push('t'); } assert_eq!(&response.build(), ":nick!user@127.0.0.1 MODE #my_channel +nt\r\n");
pub fn raw_trailing_param(&mut self) -> &mut String
[src]
Returns a buffer the caller can use to append characters to an IRC message.
Example
let mut response = Buffer::new(); { let mut msg = response.message("ellidri.dev", rpl::NAMREPLY) .param("ser"); let mut param = msg.raw_trailing_param(); param.push_str("@RandomChanOp"); param.push(' '); param.push_str("RandomUser"); } assert_eq!(&response.build(), ":ellidri.dev 353 ser :@RandomChanOp RandomUser\r\n");
Trait Implementations
impl<'_> Drop for MessageBuffer<'_>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for MessageBuffer<'a>
impl<'a> Send for MessageBuffer<'a>
impl<'a> Sync for MessageBuffer<'a>
impl<'a> Unpin for MessageBuffer<'a>
impl<'a> !UnwindSafe for MessageBuffer<'a>
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> Same<T> for T
type Output = T
Should always be Self
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,