#[repr(i32)]pub enum DataType {
Show 35 variants
Unknown = 0,
Int8 = 1,
Int16 = 2,
Int32 = 3,
Int64 = 4,
UInt8 = 5,
UInt16 = 6,
UInt32 = 7,
UInt64 = 8,
Float = 9,
Double = 10,
Boolean = 11,
String = 12,
DateTime = 13,
Text = 14,
Uuid = 15,
DataSet = 16,
Bytes = 17,
File = 18,
Template = 19,
PropertySet = 20,
PropertySetList = 21,
Int8Array = 22,
Int16Array = 23,
Int32Array = 24,
Int64Array = 25,
UInt8Array = 26,
UInt16Array = 27,
UInt32Array = 28,
UInt64Array = 29,
FloatArray = 30,
DoubleArray = 31,
BooleanArray = 32,
StringArray = 33,
DateTimeArray = 34,
}Expand description
A Sparkplug B data type code.
Values 1..=14 are the basic scalar types (valid as DataSet columns,
template parameters, and property values). 15..=19 add UUID/DataSet/Bytes/
File/Template. 20..=21 are property-value-only (PropertySet/list).
22..=34 are the array types.
Variants§
Unknown = 0
Int8 = 1
Int16 = 2
Int32 = 3
Int64 = 4
UInt8 = 5
UInt16 = 6
UInt32 = 7
UInt64 = 8
Float = 9
Double = 10
Boolean = 11
String = 12
DateTime = 13
Text = 14
Uuid = 15
DataSet = 16
Bytes = 17
File = 18
Template = 19
PropertySet = 20
PropertySetList = 21
Int8Array = 22
Int16Array = 23
Int32Array = 24
Int64Array = 25
UInt8Array = 26
UInt16Array = 27
UInt32Array = 28
UInt64Array = 29
FloatArray = 30
DoubleArray = 31
BooleanArray = 32
StringArray = 33
DateTimeArray = 34
Implementations§
Source§impl DataType
impl DataType
Sourcepub const fn as_u32(self) -> u32
pub const fn as_u32(self) -> u32
The integer code as it appears on the wire (datatype field, an unsigned
32-bit integer per tck-id-payloads-metric-datatype-value-type).
Sourcepub const fn from_u32(v: u32) -> Result<Self>
pub const fn from_u32(v: u32) -> Result<Self>
Parse a wire datatype code, rejecting unknown values
(tck-id-payloads-metric-datatype-value).
§Errors
Returns SparkplugError::UnknownDataType for codes outside 0..=34.
Sourcepub const fn is_basic(self) -> bool
pub const fn is_basic(self) -> bool
true for the basic scalar types 1..=14, the only types permitted as
DataSet columns and template parameters (tck-id-payloads-dataset-types-value).
Sourcepub const fn array_element_width(self) -> Option<usize>
pub const fn array_element_width(self) -> Option<usize>
For numeric/temporal array types, the fixed little-endian element width
in bytes. BooleanArray/StringArray use special framing and return
None, as do non-array types.