pub enum FieldType {
U8,
I8,
Char,
U16,
I16,
U32,
I32,
U64,
I64,
F32,
F64,
}Expand description
The scalar type of a message field, as a dialect declares it.
The name is the C type MAVLink writes in a message definition, which is also what the
CRC_EXTRA derivation folds in, so the spelling is part of the wire contract rather
than a label.
Variants§
U8
uint8_t, one unsigned byte.
I8
int8_t, one signed byte.
Char
char, one byte of text; an array of these carries a string.
U16
uint16_t.
I16
int16_t.
U32
uint32_t.
I32
int32_t.
U64
uint64_t.
I64
int64_t.
F32
float, IEEE 754 single precision.
F64
double, IEEE 754 double precision.
Implementations§
Source§impl FieldType
impl FieldType
Sourcepub const fn size(self) -> usize
pub const fn size(self) -> usize
Returns the size of one element of this type, in bytes.
§Returns
The element size, from one to eight bytes.
Sourcepub fn from_wire_name(name: &str) -> Option<Self>
pub fn from_wire_name(name: &str) -> Option<Self>
Resolves a C type name from a message definition.
An array declaration carries its length separately, so "uint8_t[4]" is written as
"uint8_t" with a length of four rather than parsed here.
§Arguments
name- the C type name, such as"uint16_t".
§Returns
The type, or None if the name is not one MAVLink defines.
§Examples
use pamoja_mavlink::dialect::FieldType;
assert_eq!(FieldType::from_wire_name("int32_t"), Some(FieldType::I32));
assert_eq!(FieldType::from_wire_name("size_t"), None);Sourcepub const fn is_integer(self) -> bool
pub const fn is_integer(self) -> bool
Reports whether values of this type are whole numbers.
§Returns
true for every type but float and double.