#[repr(u8)]pub enum BaseType {
Show 17 variants
Enum = 0,
SInt8 = 1,
UInt8 = 2,
SInt16 = 3,
UInt16 = 4,
SInt32 = 5,
UInt32 = 6,
String = 7,
Float32 = 8,
Float64 = 9,
UInt8z = 10,
UInt16z = 11,
UInt32z = 12,
Byte = 13,
SInt64 = 14,
UInt64 = 15,
UInt64z = 16,
}Expand description
The 17 FIT base types, indexed by their type-code byte.
Variants§
Enum = 0
0x00 — 1-byte enumeration. Invalid: 0xFF.
SInt8 = 1
0x01 — signed 8-bit. Invalid: 0x7F.
UInt8 = 2
0x02 — unsigned 8-bit. Invalid: 0xFF.
SInt16 = 3
0x03 — signed 16-bit. Invalid: 0x7FFF.
UInt16 = 4
0x04 — unsigned 16-bit. Invalid: 0xFFFF.
SInt32 = 5
0x05 — signed 32-bit. Invalid: 0x7FFFFFFF.
UInt32 = 6
0x06 — unsigned 32-bit. Invalid: 0xFFFFFFFF.
String = 7
0x07 — null-terminated UTF-8. Invalid: empty / first byte 0x00.
Float32 = 8
0x08 — IEEE 754 single. Invalid: bit-pattern 0xFFFFFFFF.
Float64 = 9
0x09 — IEEE 754 double. Invalid: bit-pattern 0xFFFFFFFFFFFFFFFF.
UInt8z = 10
0x0A — unsigned 8-bit (Z series). Invalid: 0x00.
UInt16z = 11
0x0B — unsigned 16-bit (Z series). Invalid: 0x0000.
UInt32z = 12
0x0C — unsigned 32-bit (Z series). Invalid: 0x00000000.
Byte = 13
0x0D — opaque byte array. Invalid: all elements 0xFF (special
rule: a single 0xFF element is not invalid in a multi-byte array).
SInt64 = 14
0x0E — signed 64-bit. Invalid: 0x7FFFFFFFFFFFFFFF.
UInt64 = 15
0x0F — unsigned 64-bit. Invalid: 0xFFFFFFFFFFFFFFFF.
UInt64z = 16
0x10 — unsigned 64-bit (Z series). Invalid: 0x0000000000000000.
The 17th and largest valid type code; missing from many older references but defined in current FIT SDKs.
Implementations§
Source§impl BaseType
impl BaseType
Sourcepub const TYPE_CODE_MASK: u8 = 0x1F
pub const TYPE_CODE_MASK: u8 = 0x1F
Mask to extract the type code from a field-type byte (drops endian flag).
Sourcepub const ENDIAN_FLAG: u8 = 0x80
pub const ENDIAN_FLAG: u8 = 0x80
Endian flag bit (bit 7 of a field-type byte).
Sourcepub fn from_byte(byte: u8) -> Result<Self, FitError>
pub fn from_byte(byte: u8) -> Result<Self, FitError>
Decode a raw field-type byte.
Bit 7 (the endian flag) is masked off; only the low 5 bits are
consulted. Returns FitError::UnknownBaseType if the type code
is outside the valid range 0x00..=0x10.
Sourcepub fn endian_flag_set(byte: u8) -> bool
pub fn endian_flag_set(byte: u8) -> bool
True iff bit 7 of the raw field-type byte indicates big-endian.
Sourcepub fn element_size(&self) -> usize
pub fn element_size(&self) -> usize
Size in bytes of a single element of this type. For the variable-
length types (BaseType::String and BaseType::Byte) this is the
stride per element (1 byte); the actual payload size comes from the
Field Size byte in the Definition message.
Sourcepub fn is_z_type(&self) -> bool
pub fn is_z_type(&self) -> bool
True for the Z series — types whose invalid sentinel is all zero rather than all ones. Important for invalid-value detection in M4.
Sourcepub fn is_byte(&self) -> bool
pub fn is_byte(&self) -> bool
True for BaseType::Byte. Required because the Byte type has a
special invalid-value rule (only invalid when every element is
0xFF).
Sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
True for BaseType::String.