Skip to main content

Record

Struct Record 

Source
pub struct Record { /* private fields */ }
Expand description

One moment’s samples.

A record needs a value besides its timestamp; the encoder does not check that one is set.

use fit_encoder::{Record, Timestamp};

let r = Record::new(Timestamp::from_fit(1_133_481_600)).heart_rate(128);

Implementations§

Source§

impl Record

Source

pub const fn new(timestamp: Timestamp) -> Self

A record at timestamp with no samples yet.

Source

pub const fn position(self, position: Position) -> Self

Where it was.

Source

pub const fn altitude(self, altitude: Altitude) -> Self

The altitude, which with its source sets what ascent and descent count.

Source

pub const fn heart_rate(self, bpm: u8) -> Self

The heart rate in beats per minute, up to 254.

Source

pub const fn cadence_rpm(self, rpm: u8) -> Self

The cadence in revolutions, or strides, a minute, up to 254.

Source

pub fn distance_advanced_meters(self, meters: f64) -> Self

The distance covered since the last record that gave one, to the micrometre; the writer keeps the activity’s total.

Source

pub fn distance_meters(self, meters: f64) -> Self

The distance covered since the activity started, up to 42,949,672.94 m, to the centimetre; less than a total already written is refused.

Source

pub fn speed_meters_per_second(self, speed: f64) -> Self

The speed, up to 65.534 m/s, to the millimetre a second.

Source

pub const fn power_watts(self, watts: u16) -> Self

The power in watts, up to 65,534.

Source

pub const fn temperature_celsius(self, celsius: i8) -> Self

The temperature in degrees Celsius, from -128 to 126.

Trait Implementations§

Source§

impl Clone for Record

Source§

fn clone(&self) -> Self

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 Copy for Record

Source§

impl Debug for Record

Source§

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

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

impl Eq for Record

Source§

impl PartialEq for Record

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Record

Auto Trait Implementations§

§

impl Forget for Record

§

impl Freeze for Record

§

impl Move for Record

§

impl RefUnwindSafe for Record

§

impl Send for Record

§

impl Sync for Record

§

impl Unpin for Record

§

impl UnsafeUnpin for Record

§

impl UnwindSafe for Record

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.