Skip to main content

SenMLResolvedRecord

Struct SenMLResolvedRecord 

Source
pub struct SenMLResolvedRecord {
    pub name: String,
    pub unit: Option<String>,
    pub value: Option<SenMLValueField>,
    pub sum: Option<f64>,
    pub time: DateTime<Utc>,
    pub update_time: Option<f64>,
    pub base_version: Option<u64>,
    pub extra_fields: Option<HashMap<String, Value>>,
}
Expand description

SenML Resolved Record.

A SenML Record that is extracted from a SenML Pack and has all the fields resolved, meaning that all the base fields are applied to the record.

This can be serialised to JSON using serde.

Please note that this is not the most compact SenML representation, but it is a compatible one. https://www.rfc-editor.org/rfc/rfc8428#section-4.6

Fields§

§name: String

The name of the record.

This is the concatenation of the base name and the name. The name is always present and cannot be an empty string.

§unit: Option<String>

The unit of the record.

The unit is optional and is preferably present. It should be a SI unit if possible and use the units defined in the SenML unit registries. https://www.rfc-editor.org/rfc/rfc8428.html#section-12.1 https://www.rfc-editor.org/rfc/rfc8798.html

§value: Option<SenMLValueField>

The value of the record.

The value is optional as the record can also contain a sum. The value defaults to 0.0 if both the sum and the value are missing.

§sum: Option<f64>

Integrated sum of the values over time.

This field should have been named “integral” according to the RFC but is named “sum” for historical reasons. Optional.

§time: DateTime<Utc>

Time when the value was recorded.

This is a UTC DateTime that is always present. It defaults to the current time of the system.

§update_time: Option<f64>

Period of time in seconds that represents the maximum time before the sensor will provided and updated reading for a measurement.

Optional. This can be used to detect the failure of sensors or the communications path from the sensor.

§base_version: Option<u64>

Version number of the media type format.

This field is an optional positive integer and defaults to 10 if not present.

§extra_fields: Option<HashMap<String, Value>>

Extra fields that are not part of the SenML specification but are allowed to be present and were in the JSON records.

Implementations§

Trait Implementations§

Source§

impl Clone for SenMLResolvedRecord

Source§

fn clone(&self) -> SenMLResolvedRecord

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 SenMLResolvedRecord

Source§

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

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

impl PartialEq for SenMLResolvedRecord

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for SenMLResolvedRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SenMLResolvedRecord

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

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.