Struct const_irc_message_parser::parameters::Parameters
source · pub struct Parameters<'msg> { /* private fields */ }
Expand description
All the parameters of an IrcMsg
.
Implementations§
source§impl<'msg> Parameters<'msg>
impl<'msg> Parameters<'msg>
sourcepub const fn parse(input: &'msg [u8]) -> Result<Option<Self>, ParametersError>
pub const fn parse(input: &'msg [u8]) -> Result<Option<Self>, ParametersError>
Generates Parameters
from a slice of bytes.
§Errors
Will return Err
if the input contains an invalid character as per the IRC Client Protocol Specification.
sourcepub const fn count(&self) -> usize
pub const fn count(&self) -> usize
Returns the amount of parameters in Parameters
.
sourcepub const fn content(&self) -> ContentType<'_>
pub const fn content(&self) -> ContentType<'_>
Returns all the parameters as a ContentType
.
This includes the :
before the last parameter if present.
sourcepub const fn extract_first(&self) -> ContentType<'_>
pub const fn extract_first(&self) -> ContentType<'_>
Returns the first parameter as a ContentType
.
Does not include :
for the trailing parameter.
sourcepub const fn extract_last(&self) -> ContentType<'_>
pub const fn extract_last(&self) -> ContentType<'_>
Returns the last parameter as a ContentType
.
Does not include :
for the trailing parameter.
sourcepub const fn extract_specific(
&self,
target_index: usize
) -> Option<ContentType<'_>>
pub const fn extract_specific( &self, target_index: usize ) -> Option<ContentType<'_>>
Returns the requested parameter as a ContentType
at the specified index.
Index starts at 0. If out of bounds it returns None
. Does not include :
for the trailing parameter.
sourcepub const fn is_valid_uft8(&self) -> bool
pub const fn is_valid_uft8(&self) -> bool
Checks whether the Parameters
contains non-utf8 bytes.
Trait Implementations§
source§impl<'msg> Clone for Parameters<'msg>
impl<'msg> Clone for Parameters<'msg>
source§fn clone(&self) -> Parameters<'msg>
fn clone(&self) -> Parameters<'msg>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'msg> Debug for Parameters<'msg>
impl<'msg> Debug for Parameters<'msg>
source§impl<'msg> Display for Parameters<'msg>
impl<'msg> Display for Parameters<'msg>
source§impl<'msg> PartialEq for Parameters<'msg>
impl<'msg> PartialEq for Parameters<'msg>
source§fn eq(&self, other: &Parameters<'msg>) -> bool
fn eq(&self, other: &Parameters<'msg>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'msg> Copy for Parameters<'msg>
impl<'msg> Eq for Parameters<'msg>
impl<'msg> StructuralPartialEq for Parameters<'msg>
Auto Trait Implementations§
impl<'msg> Freeze for Parameters<'msg>
impl<'msg> RefUnwindSafe for Parameters<'msg>
impl<'msg> Send for Parameters<'msg>
impl<'msg> Sync for Parameters<'msg>
impl<'msg> Unpin for Parameters<'msg>
impl<'msg> UnwindSafe for Parameters<'msg>
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