pub struct Payload {
pub timestamp: Option<u64>,
pub metrics: Vec<Metric>,
pub seq: Option<u8>,
pub uuid: Option<String>,
pub body: Option<Bytes>,
}Expand description
A complete Sparkplug B payload (the body of an N/D BIRTH/DATA/DEATH/CMD message).
Fields§
§timestamp: Option<u64>Message send time, epoch milliseconds UTC.
metrics: Vec<Metric>The metrics carried by this payload.
seq: Option<u8>The Sparkplug sequence number (0..=255); absent on NDEATH/NCMD/DCMD.
uuid: Option<String>Optional schema UUID; also the SPBV1.0_COMPRESSED sentinel for the
compression envelope.
body: Option<Bytes>Optional opaque body (used by the compression envelope).
Implementations§
Source§impl Payload
impl Payload
Sourcepub fn with_timestamp(self, ts: u64) -> Self
pub fn with_timestamp(self, ts: u64) -> Self
Builder-style setter for the payload timestamp.
Sourcepub fn with_metric(self, metric: Metric) -> Self
pub fn with_metric(self, metric: Metric) -> Self
Append a metric, consuming and returning self for chaining.
Trait Implementations§
impl StructuralPartialEq for Payload
Auto Trait Implementations§
impl !Freeze for Payload
impl RefUnwindSafe for Payload
impl Send for Payload
impl Sync for Payload
impl Unpin for Payload
impl UnsafeUnpin for Payload
impl UnwindSafe for Payload
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