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
impl ParameterList
Sourcepub fn get(&self, id: ParameterId) -> Option<&Parameter>
pub fn get(&self, id: ParameterId) -> Option<&Parameter>
The first parameter with the given id.
Sourcepub fn get_all(&self, id: ParameterId) -> impl Iterator<Item = &Parameter>
pub fn get_all(&self, id: ParameterId) -> impl Iterator<Item = &Parameter>
All parameters with the given id, in order.
Sourcepub fn decode(
bytes: &[u8],
endianness: Endianness,
require_sentinel: bool,
) -> Result<(ParameterList, usize), DecodeError>
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.
Sourcepub fn endianness(&self) -> Option<Endianness>
pub fn endianness(&self) -> Option<Endianness>
The byte order of the values of a list that was read, None for
one that was built.
Sourcepub fn encode(
&self,
out: &mut Vec<u8>,
endianness: Endianness,
sentinel: bool,
) -> Result<(), EncodeError>
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.