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
impl DynamicData
Sourcepub fn serialize(&self, enc: &mut Encoder) -> Result<(), Error>
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.
Sourcepub fn serialize_key(&self, enc: &mut Encoder) -> Result<(), Error>
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.
Sourcepub fn deserialize(
ty: &DynamicType,
dec: &mut Decoder<'_>,
) -> Result<DynamicData, Error>
pub fn deserialize( ty: &DynamicType, dec: &mut Decoder<'_>, ) -> Result<DynamicData, Error>
Reads a value of ty from dec, in the encoding of dec.
Sourcepub fn to_payload(
&self,
encoding: Encoding,
order: ByteOrder,
) -> Result<Vec<u8>, Error>
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).
Sourcepub fn from_payload(ty: &DynamicType, buf: &[u8]) -> Result<DynamicData, Error>
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§impl DynamicData
impl DynamicData
Sourcepub fn get_type(&self) -> DynamicType
pub fn get_type(&self) -> DynamicType
type: the type, its aliases resolved.
Sourcepub fn equals(&self, other: &DynamicData) -> bool
pub fn equals(&self, other: &DynamicData) -> bool
equals.
Sourcepub fn get_item_count(&self) -> u32
pub fn get_item_count(&self) -> u32
get_item_count (7.5.2.11.6).
Sourcepub fn get_member_id_by_name(&self, name: &str) -> u32
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.
Sourcepub fn get_member_id_at_index(&self, index: u32) -> u32
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).
Sourcepub fn get_descriptor(&self, id: u32) -> Result<MemberDescriptor, Error>
pub fn get_descriptor(&self, id: u32) -> Result<MemberDescriptor, Error>
The descriptor of member id (descriptor, 7.5.2.11.2).
Sourcepub fn loan_value(&mut self, id: u32) -> Result<&mut DynamicData, Error>
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).
Sourcepub fn get_complex_value(&self, id: u32) -> Result<DynamicData, Error>
pub fn get_complex_value(&self, id: u32) -> Result<DynamicData, Error>
get_complex_value: a copy of the value id names.
Sourcepub fn set_complex_value(
&mut self,
id: u32,
value: DynamicData,
) -> Result<(), Error>
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.
Sourcepub fn is_present(&self, id: u32) -> bool
pub fn is_present(&self, id: u32) -> bool
Whether the optional member id of a struct is present.
Sourcepub fn clear_all_values(&mut self) -> Result<(), Error>
pub fn clear_all_values(&mut self) -> Result<(), Error>
clear_all_values: every value back to its default.
Sourcepub fn clear_nonkey_values(&mut self) -> Result<(), Error>
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.
Sourcepub fn get_discriminator_value(&self) -> Result<i64, Error>
pub fn get_discriminator_value(&self) -> Result<i64, Error>
The discriminator of a union, as an integer (enums by their value).
Sourcepub fn set_discriminator_value(&mut self, d: i64) -> Result<(), Error>
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.
Sourcepub fn selected_member(&self) -> Option<u32>
pub fn selected_member(&self) -> Option<u32>
The ID of the member the discriminator of a union selects.
Sourcepub fn map_entries(&self) -> Result<&[(DynamicData, DynamicData)], Error>
pub fn map_entries(&self) -> Result<&[(DynamicData, DynamicData)], Error>
The entries of a map, in order.
Sourcepub fn map_get(&self, key: &DynamicData) -> Option<&DynamicData>
pub fn map_get(&self, key: &DynamicData) -> Option<&DynamicData>
The element of a map for key.
Sourcepub fn map_insert(
&mut self,
key: DynamicData,
element: DynamicData,
) -> Result<(), Error>
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).
Sourcepub fn map_remove(&mut self, key: &DynamicData) -> bool
pub fn map_remove(&mut self, key: &DynamicData) -> bool
Removes the element of a map for key; whether there was one.
Source§impl DynamicData
impl DynamicData
Sourcepub fn set_boolean_value(&mut self, id: u32, value: bool) -> Result<(), Error>
pub fn set_boolean_value(&mut self, id: u32, value: bool) -> Result<(), Error>
set_boolean_value.
Sourcepub fn get_boolean_values(&self, id: u32) -> Result<Vec<bool>, Error>
pub fn get_boolean_values(&self, id: u32) -> Result<Vec<bool>, Error>
get_boolean_values: the elements of a sequence or an array.
Sourcepub fn set_boolean_values(
&mut self,
id: u32,
values: &[bool],
) -> Result<(), Error>
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).
Sourcepub fn get_byte_values(&self, id: u32) -> Result<Vec<u8>, Error>
pub fn get_byte_values(&self, id: u32) -> Result<Vec<u8>, Error>
get_byte_values: the elements of a sequence or an array.
Sourcepub fn set_byte_values(&mut self, id: u32, values: &[u8]) -> Result<(), Error>
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).
Sourcepub fn get_int8_values(&self, id: u32) -> Result<Vec<i8>, Error>
pub fn get_int8_values(&self, id: u32) -> Result<Vec<i8>, Error>
get_int8_values: the elements of a sequence or an array.
Sourcepub fn set_int8_values(&mut self, id: u32, values: &[i8]) -> Result<(), Error>
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).
Sourcepub fn get_uint8_values(&self, id: u32) -> Result<Vec<u8>, Error>
pub fn get_uint8_values(&self, id: u32) -> Result<Vec<u8>, Error>
get_uint8_values: the elements of a sequence or an array.
Sourcepub fn set_uint8_values(&mut self, id: u32, values: &[u8]) -> Result<(), Error>
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).
Sourcepub fn get_int16_values(&self, id: u32) -> Result<Vec<i16>, Error>
pub fn get_int16_values(&self, id: u32) -> Result<Vec<i16>, Error>
get_int16_values: the elements of a sequence or an array.
Sourcepub fn set_int16_values(&mut self, id: u32, values: &[i16]) -> Result<(), Error>
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).
Sourcepub fn get_uint16_values(&self, id: u32) -> Result<Vec<u16>, Error>
pub fn get_uint16_values(&self, id: u32) -> Result<Vec<u16>, Error>
get_uint16_values: the elements of a sequence or an array.
Sourcepub fn set_uint16_values(
&mut self,
id: u32,
values: &[u16],
) -> Result<(), Error>
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).
Sourcepub fn get_int32_values(&self, id: u32) -> Result<Vec<i32>, Error>
pub fn get_int32_values(&self, id: u32) -> Result<Vec<i32>, Error>
get_int32_values: the elements of a sequence or an array.
Sourcepub fn set_int32_values(&mut self, id: u32, values: &[i32]) -> Result<(), Error>
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).
Sourcepub fn get_uint32_values(&self, id: u32) -> Result<Vec<u32>, Error>
pub fn get_uint32_values(&self, id: u32) -> Result<Vec<u32>, Error>
get_uint32_values: the elements of a sequence or an array.
Sourcepub fn set_uint32_values(
&mut self,
id: u32,
values: &[u32],
) -> Result<(), Error>
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).
Sourcepub fn get_int64_values(&self, id: u32) -> Result<Vec<i64>, Error>
pub fn get_int64_values(&self, id: u32) -> Result<Vec<i64>, Error>
get_int64_values: the elements of a sequence or an array.
Sourcepub fn set_int64_values(&mut self, id: u32, values: &[i64]) -> Result<(), Error>
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).
Sourcepub fn get_uint64_values(&self, id: u32) -> Result<Vec<u64>, Error>
pub fn get_uint64_values(&self, id: u32) -> Result<Vec<u64>, Error>
get_uint64_values: the elements of a sequence or an array.
Sourcepub fn set_uint64_values(
&mut self,
id: u32,
values: &[u64],
) -> Result<(), Error>
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).
Sourcepub fn set_float32_value(&mut self, id: u32, value: f32) -> Result<(), Error>
pub fn set_float32_value(&mut self, id: u32, value: f32) -> Result<(), Error>
set_float32_value.
Sourcepub fn get_float32_values(&self, id: u32) -> Result<Vec<f32>, Error>
pub fn get_float32_values(&self, id: u32) -> Result<Vec<f32>, Error>
get_float32_values: the elements of a sequence or an array.
Sourcepub fn set_float32_values(
&mut self,
id: u32,
values: &[f32],
) -> Result<(), Error>
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).
Sourcepub fn set_float64_value(&mut self, id: u32, value: f64) -> Result<(), Error>
pub fn set_float64_value(&mut self, id: u32, value: f64) -> Result<(), Error>
set_float64_value.
Sourcepub fn get_float64_values(&self, id: u32) -> Result<Vec<f64>, Error>
pub fn get_float64_values(&self, id: u32) -> Result<Vec<f64>, Error>
get_float64_values: the elements of a sequence or an array.
Sourcepub fn set_float64_values(
&mut self,
id: u32,
values: &[f64],
) -> Result<(), Error>
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).
Sourcepub fn get_float128_value(&self, id: u32) -> Result<LongDouble, Error>
pub fn get_float128_value(&self, id: u32) -> Result<LongDouble, Error>
get_float128_value.
Sourcepub fn set_float128_value(
&mut self,
id: u32,
value: LongDouble,
) -> Result<(), Error>
pub fn set_float128_value( &mut self, id: u32, value: LongDouble, ) -> Result<(), Error>
set_float128_value.
Sourcepub fn get_float128_values(&self, id: u32) -> Result<Vec<LongDouble>, Error>
pub fn get_float128_values(&self, id: u32) -> Result<Vec<LongDouble>, Error>
get_float128_values: the elements of a sequence or an array.
Sourcepub fn set_float128_values(
&mut self,
id: u32,
values: &[LongDouble],
) -> Result<(), Error>
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).
Sourcepub fn get_char8_values(&self, id: u32) -> Result<Vec<char>, Error>
pub fn get_char8_values(&self, id: u32) -> Result<Vec<char>, Error>
get_char8_values: the elements of a sequence or an array.
Sourcepub fn set_char8_values(
&mut self,
id: u32,
values: &[char],
) -> Result<(), Error>
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).
Sourcepub fn set_char16_value(&mut self, id: u32, value: char) -> Result<(), Error>
pub fn set_char16_value(&mut self, id: u32, value: char) -> Result<(), Error>
set_char16_value.
Trait Implementations§
Source§impl Clone for DynamicData
impl Clone for DynamicData
Source§fn clone(&self) -> DynamicData
fn clone(&self) -> DynamicData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more