Trait uavcan_core::UavcanPrimitiveField
[−]
[src]
pub trait UavcanPrimitiveField { fn is_constant_size(&self) -> bool; fn get_size(&self) -> usize; fn get_size_mut(&self) -> Option<&mut usize>; fn primitive_type_as_mut(
&mut self,
index: usize
) -> &mut UavcanPrimitiveType; fn primitive_type(&self, index: usize) -> &UavcanPrimitiveType; }
An UavcanPrimitiveField is a field of a flatted out uavcan struct
It's a superset of Primitive Data Types from the uavcan protocol also containing both constant and variable size arrays.
All primitive data types have 1 primitive fields, All composite data structures have the same number of primtiive fields as the sum of their members. Except the variable length array. This array has number of primitive fields as their members (elements)+1
Required Methods
fn is_constant_size(&self) -> bool
fn get_size(&self) -> usize
get_size(&self) -> usize returns the number of primitive data types in this field
for primtiive data types (non-array) it will return 1
fn get_size_mut(&self) -> Option<&mut usize>
get_size_mut(&self) -> Option<&mut usize> returns a mutable reference to the size if the field is of variable size, or None if the field is constant size
fn primitive_type_as_mut(&mut self, index: usize) -> &mut UavcanPrimitiveType
fn primitive_type(&self, index: usize) -> &UavcanPrimitiveType
Implementors
impl<T: UavcanPrimitiveType> UavcanPrimitiveField for T