pub struct DataPoint {
pub id: DataPointId,
pub value: Value,
pub quality: Quality,
pub timestamp: DateTime<Utc>,
pub units: Option<String>,
pub description: Option<String>,
}Expand description
A data point with value, quality, and timestamp.
Fields§
§id: DataPointIdPoint identifier.
value: ValueCurrent value.
quality: QualityQuality.
timestamp: DateTime<Utc>Timestamp.
units: Option<String>Engineering units (optional).
description: Option<String>Description (optional).
Implementations§
Source§impl DataPoint
impl DataPoint
Sourcepub fn new(id: DataPointId, value: Value) -> DataPoint
pub fn new(id: DataPointId, value: Value) -> DataPoint
Create a new data point.
Sourcepub fn bad(id: DataPointId) -> DataPoint
pub fn bad(id: DataPointId) -> DataPoint
Create a data point with bad quality.
Sourcepub fn with_quality(self, quality: Quality) -> DataPoint
pub fn with_quality(self, quality: Quality) -> DataPoint
Set the quality.
Sourcepub fn with_timestamp(self, timestamp: DateTime<Utc>) -> DataPoint
pub fn with_timestamp(self, timestamp: DateTime<Utc>) -> DataPoint
Set the timestamp.
Sourcepub fn with_units(self, units: impl Into<String>) -> DataPoint
pub fn with_units(self, units: impl Into<String>) -> DataPoint
Set the units.
Sourcepub fn with_description(self, description: impl Into<String>) -> DataPoint
pub fn with_description(self, description: impl Into<String>) -> DataPoint
Set the description.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DataPoint
impl<'de> Deserialize<'de> for DataPoint
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DataPoint, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DataPoint, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for DataPoint
impl Serialize for DataPoint
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for DataPoint
impl RefUnwindSafe for DataPoint
impl Send for DataPoint
impl Sync for DataPoint
impl Unpin for DataPoint
impl UnwindSafe for DataPoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more