Skip to main content

DynamicData

Struct DynamicData 

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

A value of a DynamicType (DynamicData, 7.5.2.11).

Values inside it are named by member ID: the members of a struct or a union, the elements of a sequence or an array (by index, arrays flattened), the flags of a bitmask (by position). The value itself is MEMBER_ID_INVALID. The getters and setters convert between integer, floating point and character types as 7.5.2.11.9 allows, and take enums as signed integers and bitmasks as unsigned ones.

Implementations§

Source§

impl DynamicData

Source

pub fn serialize(&self, enc: &mut Encoder) -> Result<(), Error>

Writes the value to enc, in the encoding of enc (XCDR1 or XCDR2), without an encapsulation header.

Source

pub fn serialize_key(&self, enc: &mut Encoder) -> Result<(), Error>

Writes the key holder of the value (see key_holder) to enc, in its encoding and byte order.

Source

pub fn deserialize( ty: &DynamicType, dec: &mut Decoder<'_>, ) -> Result<DynamicData, Error>

Reads a value of ty from dec, in the encoding of dec.

Source

pub fn to_payload( &self, encoding: Encoding, order: ByteOrder, ) -> Result<Vec<u8>, Error>

The RTPS SerializedPayload of the value: the encapsulation header of encoding (XCDR1 or XCDR2) and the extensibility of the type, the value, and the padding to 4 octets (rule 1, DDSI-RTPS 10).

Source

pub fn from_payload(ty: &DynamicType, buf: &[u8]) -> Result<DynamicData, Error>

Reads a value of ty from an RTPS SerializedPayload, whose format must be the one of the extensibility of ty (PL_CDR or PL_CDR2 for a mutable type, PLAIN_CDR or DELIMITED_CDR for an appendable one, PLAIN_CDR or PLAIN_CDR2 for a final one).

Source

pub fn key_holder(&self) -> Result<Vec<u8>, Error>

The PLAIN_CDR2 big endian serialization of the key holder of the value (7.6.8, steps 1 to 4): a final type with the key members (all the members when there are none) in the order of their member IDs, each written as its own key holder.

Source

pub fn key_hash(&self) -> Result<[u8; 16], Error>

The key hash of the value (7.6.8, step 5): the key holder padded with zeros when the largest one of the type fits in 16 octets, its MD5 otherwise.

Source§

impl DynamicData

Source

pub fn get_type(&self) -> DynamicType

type: the type, its aliases resolved.

Source

pub fn get_kind(&self) -> u8

The type kind of the value.

Source

pub fn equals(&self, other: &DynamicData) -> bool

equals.

Source

pub fn get_item_count(&self) -> u32

get_item_count (7.5.2.11.6).

Source

pub fn get_member_id_by_name(&self, name: &str) -> u32

get_member_id_by_name: of a member of a struct or union, or of a flag of a bitmask; MEMBER_ID_INVALID when there is none.

Source

pub fn get_member_id_at_index(&self, index: u32) -> u32

get_member_id_at_index: the member at index of a struct (among those present) or a union (0 is the discriminator, which has no ID here; 1 the selected member), the element at index of a collection (its index, which may be one past the end of a sequence to append).

Source

pub fn get_descriptor(&self, id: u32) -> Result<MemberDescriptor, Error>

The descriptor of member id (descriptor, 7.5.2.11.2).

Source

pub fn loan_value(&mut self, id: u32) -> Result<&mut DynamicData, Error>

loan_value: the value id names, to read or change in place (made as by the setters when it does not exist yet).

Source

pub fn get_value(&self, id: u32) -> Result<&DynamicData, Error>

The value id names, to read.

Source

pub fn get_complex_value(&self, id: u32) -> Result<DynamicData, Error>

get_complex_value: a copy of the value id names.

Source

pub fn set_complex_value( &mut self, id: u32, value: DynamicData, ) -> Result<(), Error>

set_complex_value: replaces the value id names with value, which must be of its type.

Source

pub fn is_present(&self, id: u32) -> bool

Whether the optional member id of a struct is present.

Source

pub fn clear_value(&mut self, id: u32) -> Result<(), Error>

clear_value (7.5.2.11.3).

Source

pub fn clear_all_values(&mut self) -> Result<(), Error>

clear_all_values: every value back to its default.

Source

pub fn clear_nonkey_values(&mut self) -> Result<(), Error>

clear_nonkey_values: like Self::clear_all_values, but the key members of a struct keep their values.

Source

pub fn get_discriminator_value(&self) -> Result<i64, Error>

The discriminator of a union, as an integer (enums by their value).

Source

pub fn set_discriminator_value(&mut self, d: i64) -> Result<(), Error>

Sets the discriminator of a union. The member it selects takes its default value, unless it was already the one selected.

Source

pub fn selected_member(&self) -> Option<u32>

The ID of the member the discriminator of a union selects.

Source

pub fn map_entries(&self) -> Result<&[(DynamicData, DynamicData)], Error>

The entries of a map, in order.

Source

pub fn map_get(&self, key: &DynamicData) -> Option<&DynamicData>

The element of a map for key.

Source

pub fn map_insert( &mut self, key: DynamicData, element: DynamicData, ) -> Result<(), Error>

Sets the element of a map for key (both of the map’s types).

Source

pub fn map_remove(&mut self, key: &DynamicData) -> bool

Removes the element of a map for key; whether there was one.

Source

pub fn get_string_value(&self, id: u32) -> Result<String, Error>

get_string_value.

Source

pub fn set_string_value(&mut self, id: u32, value: &str) -> Result<(), Error>

set_string_value.

Source

pub fn get_wstring_value(&self, id: u32) -> Result<String, Error>

get_wstring_value.

Source

pub fn set_wstring_value(&mut self, id: u32, value: &str) -> Result<(), Error>

set_wstring_value.

Source§

impl DynamicData

Source

pub fn get_boolean_value(&self, id: u32) -> Result<bool, Error>

get_boolean_value.

Source

pub fn set_boolean_value(&mut self, id: u32, value: bool) -> Result<(), Error>

set_boolean_value.

Source

pub fn get_boolean_values(&self, id: u32) -> Result<Vec<bool>, Error>

get_boolean_values: the elements of a sequence or an array.

Source

pub fn set_boolean_values( &mut self, id: u32, values: &[bool], ) -> Result<(), Error>

set_boolean_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_byte_value(&self, id: u32) -> Result<u8, Error>

get_byte_value.

Source

pub fn set_byte_value(&mut self, id: u32, value: u8) -> Result<(), Error>

set_byte_value.

Source

pub fn get_byte_values(&self, id: u32) -> Result<Vec<u8>, Error>

get_byte_values: the elements of a sequence or an array.

Source

pub fn set_byte_values(&mut self, id: u32, values: &[u8]) -> Result<(), Error>

set_byte_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_int8_value(&self, id: u32) -> Result<i8, Error>

get_int8_value.

Source

pub fn set_int8_value(&mut self, id: u32, value: i8) -> Result<(), Error>

set_int8_value.

Source

pub fn get_int8_values(&self, id: u32) -> Result<Vec<i8>, Error>

get_int8_values: the elements of a sequence or an array.

Source

pub fn set_int8_values(&mut self, id: u32, values: &[i8]) -> Result<(), Error>

set_int8_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_uint8_value(&self, id: u32) -> Result<u8, Error>

get_uint8_value.

Source

pub fn set_uint8_value(&mut self, id: u32, value: u8) -> Result<(), Error>

set_uint8_value.

Source

pub fn get_uint8_values(&self, id: u32) -> Result<Vec<u8>, Error>

get_uint8_values: the elements of a sequence or an array.

Source

pub fn set_uint8_values(&mut self, id: u32, values: &[u8]) -> Result<(), Error>

set_uint8_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_int16_value(&self, id: u32) -> Result<i16, Error>

get_int16_value.

Source

pub fn set_int16_value(&mut self, id: u32, value: i16) -> Result<(), Error>

set_int16_value.

Source

pub fn get_int16_values(&self, id: u32) -> Result<Vec<i16>, Error>

get_int16_values: the elements of a sequence or an array.

Source

pub fn set_int16_values(&mut self, id: u32, values: &[i16]) -> Result<(), Error>

set_int16_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_uint16_value(&self, id: u32) -> Result<u16, Error>

get_uint16_value.

Source

pub fn set_uint16_value(&mut self, id: u32, value: u16) -> Result<(), Error>

set_uint16_value.

Source

pub fn get_uint16_values(&self, id: u32) -> Result<Vec<u16>, Error>

get_uint16_values: the elements of a sequence or an array.

Source

pub fn set_uint16_values( &mut self, id: u32, values: &[u16], ) -> Result<(), Error>

set_uint16_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_int32_value(&self, id: u32) -> Result<i32, Error>

get_int32_value.

Source

pub fn set_int32_value(&mut self, id: u32, value: i32) -> Result<(), Error>

set_int32_value.

Source

pub fn get_int32_values(&self, id: u32) -> Result<Vec<i32>, Error>

get_int32_values: the elements of a sequence or an array.

Source

pub fn set_int32_values(&mut self, id: u32, values: &[i32]) -> Result<(), Error>

set_int32_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_uint32_value(&self, id: u32) -> Result<u32, Error>

get_uint32_value.

Source

pub fn set_uint32_value(&mut self, id: u32, value: u32) -> Result<(), Error>

set_uint32_value.

Source

pub fn get_uint32_values(&self, id: u32) -> Result<Vec<u32>, Error>

get_uint32_values: the elements of a sequence or an array.

Source

pub fn set_uint32_values( &mut self, id: u32, values: &[u32], ) -> Result<(), Error>

set_uint32_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_int64_value(&self, id: u32) -> Result<i64, Error>

get_int64_value.

Source

pub fn set_int64_value(&mut self, id: u32, value: i64) -> Result<(), Error>

set_int64_value.

Source

pub fn get_int64_values(&self, id: u32) -> Result<Vec<i64>, Error>

get_int64_values: the elements of a sequence or an array.

Source

pub fn set_int64_values(&mut self, id: u32, values: &[i64]) -> Result<(), Error>

set_int64_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_uint64_value(&self, id: u32) -> Result<u64, Error>

get_uint64_value.

Source

pub fn set_uint64_value(&mut self, id: u32, value: u64) -> Result<(), Error>

set_uint64_value.

Source

pub fn get_uint64_values(&self, id: u32) -> Result<Vec<u64>, Error>

get_uint64_values: the elements of a sequence or an array.

Source

pub fn set_uint64_values( &mut self, id: u32, values: &[u64], ) -> Result<(), Error>

set_uint64_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_float32_value(&self, id: u32) -> Result<f32, Error>

get_float32_value.

Source

pub fn set_float32_value(&mut self, id: u32, value: f32) -> Result<(), Error>

set_float32_value.

Source

pub fn get_float32_values(&self, id: u32) -> Result<Vec<f32>, Error>

get_float32_values: the elements of a sequence or an array.

Source

pub fn set_float32_values( &mut self, id: u32, values: &[f32], ) -> Result<(), Error>

set_float32_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_float64_value(&self, id: u32) -> Result<f64, Error>

get_float64_value.

Source

pub fn set_float64_value(&mut self, id: u32, value: f64) -> Result<(), Error>

set_float64_value.

Source

pub fn get_float64_values(&self, id: u32) -> Result<Vec<f64>, Error>

get_float64_values: the elements of a sequence or an array.

Source

pub fn set_float64_values( &mut self, id: u32, values: &[f64], ) -> Result<(), Error>

set_float64_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_float128_value(&self, id: u32) -> Result<LongDouble, Error>

get_float128_value.

Source

pub fn set_float128_value( &mut self, id: u32, value: LongDouble, ) -> Result<(), Error>

set_float128_value.

Source

pub fn get_float128_values(&self, id: u32) -> Result<Vec<LongDouble>, Error>

get_float128_values: the elements of a sequence or an array.

Source

pub fn set_float128_values( &mut self, id: u32, values: &[LongDouble], ) -> Result<(), Error>

set_float128_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_char8_value(&self, id: u32) -> Result<char, Error>

get_char8_value.

Source

pub fn set_char8_value(&mut self, id: u32, value: char) -> Result<(), Error>

set_char8_value.

Source

pub fn get_char8_values(&self, id: u32) -> Result<Vec<char>, Error>

get_char8_values: the elements of a sequence or an array.

Source

pub fn set_char8_values( &mut self, id: u32, values: &[char], ) -> Result<(), Error>

set_char8_values: the elements of a sequence (all of them) or an array (as many as it has).

Source

pub fn get_char16_value(&self, id: u32) -> Result<char, Error>

get_char16_value.

Source

pub fn set_char16_value(&mut self, id: u32, value: char) -> Result<(), Error>

set_char16_value.

Source

pub fn get_char16_values(&self, id: u32) -> Result<Vec<char>, Error>

get_char16_values: the elements of a sequence or an array.

Source

pub fn set_char16_values( &mut self, id: u32, values: &[char], ) -> Result<(), Error>

set_char16_values: the elements of a sequence (all of them) or an array (as many as it has).

Trait Implementations§

Source§

impl Clone for DynamicData

Source§

fn clone(&self) -> DynamicData

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 DynamicData

Source§

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

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

impl PartialEq for DynamicData

Source§

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

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

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

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !Freeze for DynamicData

§

impl Forget for DynamicData

§

impl Move for DynamicData

§

impl RefUnwindSafe for DynamicData

§

impl Send for DynamicData

§

impl Sync for DynamicData

§

impl Unpin for DynamicData

§

impl UnsafeUnpin for DynamicData

§

impl UnwindSafe for DynamicData

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.