pub enum MetricValue {
Show 33 variants
Int8(i8),
Int16(i16),
Int32(i32),
Int64(i64),
UInt8(u8),
UInt16(u16),
UInt32(u32),
UInt64(u64),
Float(f32),
Double(f64),
Boolean(bool),
String(String),
Text(String),
Uuid(String),
DateTime(i64),
Bytes(Bytes),
File(Bytes),
DataSet(DataSet),
Template(Box<Template>),
Int8Array(Vec<i8>),
Int16Array(Vec<i16>),
Int32Array(Vec<i32>),
Int64Array(Vec<i64>),
UInt8Array(Vec<u8>),
UInt16Array(Vec<u16>),
UInt32Array(Vec<u32>),
UInt64Array(Vec<u64>),
FloatArray(Vec<f32>),
DoubleArray(Vec<f64>),
BooleanArray(Vec<bool>),
StringArray(Vec<String>),
DateTimeArray(Vec<i64>),
Null(DataType),
}Expand description
The value carried by a crate::model::Metric.
The active variant determines the on-wire DataType; the sole exception is
MetricValue::Null, which carries its declared datatype explicitly (a null
metric still has a declared type, expressed on the wire as is_null = true).
Variants§
Int8(i8)
Int16(i16)
Int32(i32)
Int64(i64)
UInt8(u8)
UInt16(u16)
UInt32(u32)
UInt64(u64)
Float(f32)
Double(f64)
Boolean(bool)
String(String)
Text(String)
Uuid(String)
DateTime(i64)
Epoch milliseconds, UTC (tck-id-payloads-timestamp-in-UTC).
Bytes(Bytes)
File(Bytes)
DataSet(DataSet)
Template(Box<Template>)
Int8Array(Vec<i8>)
Int16Array(Vec<i16>)
Int32Array(Vec<i32>)
Int64Array(Vec<i64>)
UInt8Array(Vec<u8>)
UInt16Array(Vec<u16>)
UInt32Array(Vec<u32>)
UInt64Array(Vec<u64>)
FloatArray(Vec<f32>)
DoubleArray(Vec<f64>)
BooleanArray(Vec<bool>)
StringArray(Vec<String>)
DateTimeArray(Vec<i64>)
Null(DataType)
A null value with its declared datatype (encoded as is_null = true).
Implementations§
Source§impl MetricValue
impl MetricValue
Sourcepub fn null(dt: DataType) -> Result<Self>
pub fn null(dt: DataType) -> Result<Self>
Construct a checked null value, rejecting datatypes that are invalid for
a metric (Unknown, and the property-only PropertySet/PropertySetList).
This prevents emitting a non-conformant datatype field on the wire.
§Errors
Returns SparkplugError::ValueTypeMismatch if dt is not a valid
metric datatype.
Trait Implementations§
Source§impl Clone for MetricValue
impl Clone for MetricValue
Source§fn clone(&self) -> MetricValue
fn clone(&self) -> MetricValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 MetricValue
impl Debug for MetricValue
Source§impl PartialEq for MetricValue
impl PartialEq for MetricValue
Source§fn eq(&self, other: &MetricValue) -> bool
fn eq(&self, other: &MetricValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MetricValue
Auto Trait Implementations§
impl !Freeze for MetricValue
impl RefUnwindSafe for MetricValue
impl Send for MetricValue
impl Sync for MetricValue
impl Unpin for MetricValue
impl UnsafeUnpin for MetricValue
impl UnwindSafe for MetricValue
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