Skip to main content

Params

Struct Params 

Source
pub struct Params { /* private fields */ }
Expand description

An ordered list of parameters.

Implementations§

Source§

impl Params

Source

pub fn new() -> Self

An empty list.

Source

pub fn len(&self) -> usize

How many parameters are present, counting duplicates.

Source

pub fn is_empty(&self) -> bool

Whether the list is empty.

Source

pub fn push(&mut self, param: Param)

Append a parameter, keeping any existing one of the same name.

Source

pub fn remove(&mut self, name: &str) -> bool

Remove every parameter with this name, and say whether any was there.

Every one, not the first: the list preserves duplicates because a message may contain them, and leaving a second copy behind after removing the first would be a silent change of meaning rather than a removal.

Source

pub fn iter(&self) -> impl Iterator<Item = &Param>

Every parameter, in wire order.

Source

pub fn get(&self, name: &str) -> Option<&Param>

The first parameter with this name, if any. Names compare case-insensitively.

Source

pub fn value(&self, name: &str) -> Option<&[u8]>

The value of the first parameter with this name.

Returns None both when the parameter is absent and when it is present without a value; use Params::contains to tell those apart, because ;lr and no lr at all mean different things.

Source

pub fn contains(&self, name: &str) -> bool

Whether a parameter with this name is present, with or without a value.

Source

pub fn write_to(&self, out: &mut Vec<u8>, separator: u8)

Serialize as ;name=value pairs, in order.

Trait Implementations§

Source§

impl Clone for Params

Source§

fn clone(&self) -> Params

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Params

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Params

Source§

fn default() -> Params

Returns the “default value” for a type. Read more
Source§

impl FromIterator<Param> for Params

Source§

fn from_iter<T: IntoIterator<Item = Param>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> IntoIterator for &'a Params

Source§

type Item = &'a Param

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Param>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.