pub struct MessageDefinition {
pub global_mesg_num: u16,
pub endian: Endian,
pub fields: SmallVec<[FieldDefinition; 48]>,
pub dev_fields: SmallVec<[DeveloperFieldDefinition; 8]>,
pub reserved: u8,
}Expand description
A complete Definition message.
fields and dev_fields use SmallVec with inline capacity tuned to
fit typical FIT messages on the stack. The whole struct is ~256B inline
so LocalDefinitions (16 slots) sits in ~4KB — well within L1d. Cloning
is a memcpy with no heap allocation in the common case.
Fields§
§global_mesg_num: u16Profile-level (global) message number — the index into MesgNum.
endian: EndianEndianness for multi-byte fields in subsequent Data messages.
fields: SmallVec<[FieldDefinition; 48]>Standard fields, in wire order.
dev_fields: SmallVec<[DeveloperFieldDefinition; 8]>Developer fields, in wire order. Empty unless the definition’s record header had the dev-data bit set.
reserved: u8Reserved byte preserved verbatim (always 0x00 for compliant files,
but kept so the encoder can reproduce non-compliant input bit-for-bit).
Implementations§
Source§impl MessageDefinition
impl MessageDefinition
Sourcepub fn parse(
stream: &mut ByteStream<'_>,
has_dev_data: bool,
) -> Result<Self, FitError>
pub fn parse( stream: &mut ByteStream<'_>, has_dev_data: bool, ) -> Result<Self, FitError>
Parse the body of a Definition message from stream.
Assumes the 1-byte record header has already been consumed and that
has_dev_data reflects bit 5 of that header.
Sourcepub fn data_size(&self) -> usize
pub fn data_size(&self) -> usize
Total bytes consumed by a single Data message (excluding its 1-byte header) keyed by this definition.
Sourcepub fn field(&self, field_def_num: u8) -> Option<&FieldDefinition>
pub fn field(&self, field_def_num: u8) -> Option<&FieldDefinition>
Look up a standard field by its definition number.
Trait Implementations§
Source§impl Clone for MessageDefinition
impl Clone for MessageDefinition
Source§fn clone(&self) -> MessageDefinition
fn clone(&self) -> MessageDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageDefinition
impl Debug for MessageDefinition
Source§impl PartialEq for MessageDefinition
impl PartialEq for MessageDefinition
Source§fn eq(&self, other: &MessageDefinition) -> bool
fn eq(&self, other: &MessageDefinition) -> bool
self and other values to be equal, and is used by ==.