Skip to main content

PeripheralFields

Struct PeripheralFields 

Source
pub struct PeripheralFields {
    pub callsign: Option<String>,
    pub battery_percent: Option<u8>,
    pub heart_rate: Option<u8>,
    pub event_type: Option<u8>,
    pub latitude: Option<f32>,
    pub longitude: Option<f32>,
    pub altitude: Option<f32>,
    pub activity_level: Option<u8>,
    pub alerts: Option<u8>,
}
Expand description

Subset of merged-peripheral fields surfaced on DataReceivedResult. Returned by DataReceivedResult::peripheral_fields so callers don’t have to destructure a positional tuple — adding a new field is a struct update with the type system enforcing every consumer either reads or ignores it explicitly, instead of silently re-indexing existing destructures.

Fields§

§callsign: Option<String>

Sender’s callsign (None when the peripheral has an empty callsign).

§battery_percent: Option<u8>

Sender’s battery percentage (None when the peripheral reports 0, which the wire convention treats as “absent”).

§heart_rate: Option<u8>

Sender’s heart rate (None when the wire byte is 0 — the unwrap_or(0) convention from the Rust encode side).

§event_type: Option<u8>

Sender’s PeripheralEvent type (None when no event is attached).

§latitude: Option<f32>

Sender’s latitude (None when no location record is attached).

§longitude: Option<f32>

Sender’s longitude (None when no location record is attached).

§altitude: Option<f32>

Sender’s altitude in meters (None when no location record is attached, or when the location’s altitude field is itself absent).

§activity_level: Option<u8>

Sender’s activity level (0=Standing, 3=PossibleFall, 4=Prone …).

§alerts: Option<u8>

Sender’s health-alerts bitfield (e.g. ALERT_MAN_DOWN = 0x01).

Trait Implementations§

Source§

impl Clone for PeripheralFields

Source§

fn clone(&self) -> PeripheralFields

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 PeripheralFields

Source§

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

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

impl Default for PeripheralFields

Source§

fn default() -> PeripheralFields

Returns the “default value” for a type. Read more

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> Same for T

Source§

type Output = T

Should always be Self
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.