Skip to main content

ParameterList

Struct ParameterList 

Source
pub struct ParameterList {
    pub parameters: Vec<Parameter>,
    /* private fields */
}
Expand description

A list of parameters.

PID_PAD entries are dropped when reading and never written. The sentinel is not stored: it is written by ParameterList::encode when asked for.

Fields§

§parameters: Vec<Parameter>

The parameters in wire order. An id may appear more than once.

Implementations§

Source§

impl ParameterList

Source

pub fn new() -> Self

An empty list.

Source

pub fn get(&self, id: ParameterId) -> Option<&Parameter>

The first parameter with the given id.

Source

pub fn get_all(&self, id: ParameterId) -> impl Iterator<Item = &Parameter>

All parameters with the given id, in order.

Source

pub fn push(&mut self, parameter: Parameter)

Appends a parameter.

Source

pub fn decode( bytes: &[u8], endianness: Endianness, require_sentinel: bool, ) -> Result<(ParameterList, usize), DecodeError>

Reads a parameter list from the start of bytes.

With require_sentinel, the list must end with PID_SENTINEL (every parameter list except the one in a HeaderExtension, 9.4.2.11.1); without it, the list may also end at the end of bytes. Returns the list and the number of octets read, including the sentinel.

Source

pub fn endianness(&self) -> Option<Endianness>

The byte order of the values of a list that was read, None for one that was built.

Source

pub fn encode( &self, out: &mut Vec<u8>, endianness: Endianness, sentinel: bool, ) -> Result<(), EncodeError>

Writes the list to the end of out.

Each value is padded with zeros to a multiple of four octets, so that every parameter starts on a 4-octet boundary (9.4.2.11.1). With sentinel, PID_SENTINEL is written at the end.

Trait Implementations§

Source§

impl Clone for ParameterList

Source§

fn clone(&self) -> Self

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 ParameterList

Source§

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

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

impl Default for ParameterList

Source§

fn default() -> Self

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

impl Eq for ParameterList

Source§

impl Hash for ParameterList

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ParameterList

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.