pub enum Value {
Invalid,
SInt(i64),
UInt(u64),
Float(f64),
String(String),
Bytes(Vec<u8>),
Bool(bool),
Enum(Cow<'static, str>),
DateTime(DateTime<Utc>),
Array(Vec<Value>),
}Expand description
A fully-transformed field value.
Variants§
Invalid
Invalid or unsupported field value.
SInt(i64)
Untransformed signed integer (no scale/offset applied).
UInt(u64)
Untransformed unsigned integer.
Float(f64)
Either a Float32/Float64 base value, or any numeric value that
has had non-identity scale/offset applied.
String(String)
UTF-8 string.
Bytes(Vec<u8>)
Opaque byte array.
Bool(bool)
Boolean value.
Enum(Cow<'static, str>)
Resolved enum value (e.g. "running" for Sport::Running).
Backed by Cow<'static, str> so that the common case — names
returned from the static Profile dispatcher — is a zero-allocation
borrow, while developer-defined enum values can still own a
runtime String. Construct with
Value::Enum("running".into()) (works for both &'static str and
String); read via Deref<Target=str> (s.is_empty(),
&s[..], &*s, etc.).
DateTime(DateTime<Utc>)
FIT timestamp converted to wall-clock UTC. With the chrono feature
disabled this carries the raw FIT epoch seconds (u32) instead.
Array(Vec<Value>)
Multi-element field. Each entry is a Value of homogeneous type.
Implementations§
Source§impl Value
impl Value
Sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Returns true if this is Value::Invalid.
Sourcepub fn as_datetime(&self) -> Option<DateTime<Utc>>
pub fn as_datetime(&self) -> Option<DateTime<Utc>>
Extract a DateTime<Utc> from the DateTime variant.