pub struct TelemetryData {
pub device_id: i32,
pub device_name: String,
pub timestamp: DateTime<Utc>,
pub values: Vec<PointValue>,
pub metadata: HashMap<String, Value>,
}Expand description
Northward envelope protocol types (re-exported at crate root). Telemetry data message
Fields§
§device_id: i32Device identifier
device_name: StringDevice name
timestamp: DateTime<Utc>Timestamp of the data
values: Vec<PointValue>Telemetry values as point-id keyed updates.
point_id is the primary key for all hot-path operations.
metadata: HashMap<String, Value>Additional metadata
Implementations§
Source§impl TelemetryData
impl TelemetryData
Sourcepub fn new(
device_id: i32,
device_name: impl Into<String>,
values: Vec<PointValue>,
) -> Self
pub fn new( device_id: i32, device_name: impl Into<String>, values: Vec<PointValue>, ) -> Self
Create new telemetry data
Sourcepub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self
Add metadata to the telemetry data
Sourcepub fn to_json_bytes(&self) -> Result<Bytes, Error>
pub fn to_json_bytes(&self) -> Result<Bytes, Error>
Serialize to JSON bytes with zero-copy optimization
Trait Implementations§
Source§impl Clone for TelemetryData
impl Clone for TelemetryData
Source§fn clone(&self) -> TelemetryData
fn clone(&self) -> TelemetryData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TelemetryData
impl Debug for TelemetryData
Source§impl<'de> Deserialize<'de> for TelemetryData
impl<'de> Deserialize<'de> for TelemetryData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TelemetryData
impl RefUnwindSafe for TelemetryData
impl Send for TelemetryData
impl Sync for TelemetryData
impl Unpin for TelemetryData
impl UnwindSafe for TelemetryData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.