Skip to main content

RecordHeader

Enum RecordHeader 

Source
pub enum RecordHeader {
    Definition {
        local_mesg_num: u8,
        has_dev_data: bool,
    },
    Data {
        local_mesg_num: u8,
    },
    CompressedTimestamp {
        local_mesg_num: u8,
        timestamp_offset: u8,
    },
}
Expand description

Classification of a single record-header byte.

Variants§

§

Definition

Definition message — declares the schema for one of the 16 local slots.

Fields

§local_mesg_num: u8

Local message number (0..=15).

§has_dev_data: bool

True when bit 5 is set: Definition is followed by developer-field definitions in addition to the standard fields.

§

Data

Data message — payload follows, parsed against the Definition stored in local_mesg_num’s slot.

Fields

§local_mesg_num: u8

Local message number (0..=15).

§

CompressedTimestamp

Compressed-timestamp data message. Bit 7 = 1; only 2 bits available for local_mesg_num, 5 bits for the timestamp delta against the most recent full timestamp seen.

Fields

§local_mesg_num: u8

Local message number (0..=3, 2-bit field).

§timestamp_offset: u8

Timestamp delta in seconds against the last full timestamp (0..=31).

Implementations§

Source§

impl RecordHeader

Source

pub const COMPRESSED_TIMESTAMP_MASK: u8 = 0x80

Bit 7. When set, this is a CompressedTimestamp data record.

Source

pub const DEFINITION_MASK: u8 = 0x40

Bit 6 (only meaningful when bit 7 = 0). When set, this is a Definition.

Source

pub const DEV_DATA_MASK: u8 = 0x20

Bit 5 (only meaningful when bit 6 = 1). When set, the Definition contains developer-field declarations.

Source

pub const LOCAL_MESG_NUM_MASK: u8 = 0x0F

Bits [3:0]. Local message number for Definition / Data records.

Source

pub const COMPRESSED_LOCAL_MASK: u8 = 0x60

Bits [6:5]. Local message number when the compressed-timestamp bit is set.

Source

pub const TIMESTAMP_OFFSET_MASK: u8 = 0x1F

Bits [4:0]. Timestamp delta for compressed-timestamp records (0..=31 seconds).

Source

pub fn classify(byte: u8) -> Self

Decode a single record-header byte.

Source

pub fn local_mesg_num(&self) -> u8

Local message number, common to all three record types.

Source

pub fn has_dev_data(&self) -> bool

True iff this is a Definition with the developer-data flag set.

Trait Implementations§

Source§

impl Clone for RecordHeader

Source§

fn clone(&self) -> RecordHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RecordHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RecordHeader

Source§

fn eq(&self, other: &RecordHeader) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for RecordHeader

Source§

impl Eq for RecordHeader

Source§

impl StructuralPartialEq for RecordHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.