#[non_exhaustive]pub enum Value {
Null,
Bool(bool),
Integer(i64),
Unsigned(u64),
Float(f64),
String(String),
Bytes(Vec<u8>),
Array(Vec<Value>),
Map(BTreeMap<String, Value>),
}Expand description
A tree-shaped value that can be read from or written to a Store.
This is the universal data representation in StructFS. It maps directly to JSON, MessagePack, CBOR, etc., but is encoding-agnostic.
§Design Notes
- Uses
BTreeMapfor deterministic UTF-8 key ordering - Includes
Bytesfor binary data (unlike JSON, but like CBOR/MessagePack) - Integers cover the union of i64 and u64; signedness is not semantic
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
A present null value. Distinct from “path doesn’t exist”.
Bool(bool)
Boolean value.
Integer(i64)
Signed 64-bit integer.
Unsigned(u64)
Nonnegative integer storage; normalized values use this only above i64::MAX.
Float(f64)
64-bit floating point.
String(String)
UTF-8 string.
Bytes(Vec<u8>)
Binary data (for formats that support it: CBOR, MessagePack, etc.)
Array(Vec<Value>)
Ordered sequence of values.
Map(BTreeMap<String, Value>)
Key-value map with string keys (the “struct” part).
Implementations§
Source§impl Value
impl Value
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
Normalize signedness and NaNs recursively. Ordinary PartialEq is unchanged.
Sourcepub fn semantic_eq(&self, other: &Self) -> bool
pub fn semantic_eq(&self, other: &Self) -> bool
Equality defined by StructFS Value v1, including NaN equality and signed zero.
Sourcepub fn get(&self, path: &Path) -> Option<&Value>
pub fn get(&self, path: &Path) -> Option<&Value>
Get a reference to a nested value by path.
Returns None if the path doesn’t exist or can’t be navigated
(e.g., trying to index into a string).
Sourcepub fn get_mut(&mut self, path: &Path) -> Option<&mut Value>
pub fn get_mut(&mut self, path: &Path) -> Option<&mut Value>
Get a mutable reference to a nested value by path.