Skip to main content

DecodedPacket

Struct DecodedPacket 

Source
pub struct DecodedPacket<'db, 'p> { /* private fields */ }
Expand description

The result of decoding one packet.

Values are kept in decode order. If a parameter is decoded more than once — which an entry list can do — the later value replaces the earlier one in place, so the packet reads as a map with stable ordering, exactly as the reference implementation’s dict does.

Implementations§

Source§

impl<'db, 'p> DecodedPacket<'db, 'p>

Source

pub fn db(&self) -> &'db XtceDb

The database this packet was decoded against.

Source

pub fn data(&self) -> &'p [u8] ⓘ

The packet bytes.

Source

pub fn container(&self) -> ContainerId

The most derived container that matched.

Source

pub fn bits_consumed(&self) -> usize

Bits consumed by the entry lists that ran.

Source

pub fn trailing_bits(&self) -> isize

Bits in the packet that no entry claimed.

Non-zero is not an error — the reference implementation only warns — but it usually means the definition and the packet disagree, so it is worth surfacing.

Source

pub fn values(&self) -> &[ParameterValue<'db, 'p>]

Decoded values, in decode order.

Source

pub fn len(&self) -> usize

Number of decoded parameters.

Source

pub fn is_empty(&self) -> bool

Whether nothing was decoded.

Source

pub fn get(&self, parameter: ParamId) -> Option<&ParameterValue<'db, 'p>>

A decoded value by parameter id.

Source

pub fn get_by_name(&self, name: &str) -> Option<&ParameterValue<'db, 'p>>

A decoded value by parameter name.

Source

pub fn iter_named( &self, ) -> impl Iterator<Item = (&'db str, &ParameterValue<'db, 'p>)>

Iterates (name, value) pairs in decode order.

Trait Implementations§

Source§

impl Debug for DecodedPacket<'_, '_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'db, 'p> Forget for DecodedPacket<'db, 'p>

§

impl<'db, 'p> Freeze for DecodedPacket<'db, 'p>

§

impl<'db, 'p> Move for DecodedPacket<'db, 'p>

§

impl<'db, 'p> RefUnwindSafe for DecodedPacket<'db, 'p>

§

impl<'db, 'p> Send for DecodedPacket<'db, 'p>

§

impl<'db, 'p> Sync for DecodedPacket<'db, 'p>

§

impl<'db, 'p> Unpin for DecodedPacket<'db, 'p>

§

impl<'db, 'p> UnsafeUnpin for DecodedPacket<'db, 'p>

§

impl<'db, 'p> UnwindSafe for DecodedPacket<'db, 'p>

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> 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, 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.