pub enum Value {
Null,
Bool(bool),
Int(i64),
Float(f64),
Str(SmolStr),
Array(Vec<Value>),
Object(BTreeMap<String, Value>),
}Expand description
A single Thing property value — closed sum, JSON-shaped.
Value deliberately does not provide arithmetic or comparison helpers;
protocol crates lift it into typed shapes via DataType (see the
crate::binding module).
Variants§
Null
Explicit null. Encoded as JSON null.
Bool(bool)
true / false.
Int(i64)
Integer in the i64 range. Most industrial sensors fit here.
Float(f64)
IEEE-754 double. Use when the source has fractional units.
Str(SmolStr)
Short string — backed by SmolStr so values up to 23 bytes are inline.
Array(Vec<Value>)
Heterogeneous list. Requires the alloc feature (always enabled by
default; only MCU-with-no-allocator builds turn it off).
Object(BTreeMap<String, Value>)
Object with string keys. Requires the alloc feature.
Implementations§
Source§impl Value
impl Value
Sourcepub const fn is_null(&self) -> bool
pub const fn is_null(&self) -> bool
Returns true if the value is Value::Null.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Borrow the inner string if self is Value::Str.
Sourcepub const fn as_int(&self) -> Option<i64>
pub const fn as_int(&self) -> Option<i64>
Returns the inner integer if self is Value::Int.
Sourcepub fn as_float(&self) -> Option<f64>
pub fn as_float(&self) -> Option<f64>
Returns the inner float if self is Value::Float or
Value::Int (lossy widening on Int).