Skip to main content

ParameterList

Struct ParameterList 

Source
pub struct ParameterList {
    pub parameters: Vec<Parameter>,
}
Expand description

ParameterList = a sequence of parameters + a sentinel terminator.

Fields§

§parameters: Vec<Parameter>

List of parameters (without the sentinel — it is appended automatically on encode).

Implementations§

Source§

impl ParameterList

Source

pub fn new() -> Self

Empty list.

Source

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

Append a parameter.

Source

pub fn find(&self, id: u16) -> Option<&Parameter>

Find the first parameter with id.

Source

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

ALL parameters with id (DDSI-RTPS 2.5 §9.4.2.11: a PID may appear multiple times, e.g. several *_UNICAST_LOCATOR of a multi-homed peer).

Source

pub fn validate_must_understand<F>(&self, is_known: F) -> Result<(), WireError>
where F: Fn(u16) -> bool,

Validates the ParameterList against the must-understand rule (DDSI-RTPS 2.5 §9.4.2.11.2).

Spec behavior:

“If the receiver does not understand a parameter and the must_understand bit (0x4000) is set, the entire RTPS message carrying this ParameterList MUST be discarded.”

is_known is a classifier: returns true for all PIDs the receiver understands (without the must-understand and vendor bits, i.e. the masked PID).

§Errors

ValueOutOfRange with a marker message on violation — the caller MUST discard the whole message.

Source

pub fn validate_must_understand_in_data_pipeline(&self) -> Result<(), WireError>

Convenience wrapper around Self::validate_must_understand with the standard-conformant is_standard_pid classifier. Called in the receiver pipeline hot path (crates/rtps/src/datagram.rs::decode_datagram), so the spec §9.4.2.11.2 reject rule applies automatically.

Vendor-specific PIDs (top bit set) are explicitly allowed — the vendor-bit path survives the check in validate_must_understand, because masked strips the vendor bit but is_standard_pid does not add it back; the caller treats vendor PIDs as “can be ignored”.

§Errors

ValueOutOfRange on violation — the caller discards the message.

Source

pub fn to_bytes(&self, little_endian: bool) -> Vec<u8>

Encodes to bytes with the given endianness. Padding to the 4-byte boundary is inserted automatically per value; the sentinel is appended.

Source

pub fn from_bytes(bytes: &[u8], little_endian: bool) -> Result<Self, WireError>

Decodes a ParameterList from bytes. Stops at the sentinel.

§Errors

UnexpectedEof on truncated input; ValueOutOfRange if the length is not 4-byte aligned; ValueOutOfRange if the parameter count exceeds MAX_PARAMETERS (DoS cap).

Trait Implementations§

Source§

impl Clone for ParameterList

Source§

fn clone(&self) -> ParameterList

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 PartialEq for ParameterList

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ParameterList

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