pub enum MetadataValue {
Null,
Bool(bool),
Signed(i64),
Unsigned(u64),
Float(f64),
String(String),
Bytes(Box<[u8]>),
Array(Vec<MetadataValue>),
Object(Metadata),
}Expand description
A value in the closed, portable metadata tree.
§Nesting depth
A value nests without any limit in memory, which is why Clone and
Drop are implemented iteratively here. Serialization is the one place
that cannot follow suit: serde expresses nesting through nested calls and
consumes each level’s compound serializer by value, so no work stack can hold
the intermediates. With the serde feature enabled, a value nested more than
128 levels deep is therefore refused in both directions with a typed
error — never truncated, and never allowed to overflow the stack. 128 is
serde_json’s own default recursion limit, so reef’s bound is not the first
one a JSON caller meets; realistic metadata is under ten levels deep.
Variants§
Null
A null value.
Bool(bool)
A boolean value.
Signed(i64)
A signed integer.
Unsigned(u64)
An unsigned integer.
Float(f64)
A floating-point value, including every f64 bit pattern.
String(String)
A UTF-8 string.
Bytes(Box<[u8]>)
Owned arbitrary bytes.
Array(Vec<MetadataValue>)
An ordered array.
Object(Metadata)
A nested string-keyed object.
Implementations§
Source§impl MetadataValue
impl MetadataValue
Sourcepub fn as_borrowed(&self) -> MetadataValueRef<'_>
pub fn as_borrowed(&self) -> MetadataValueRef<'_>
Borrows this value without losing its closed variant or payload.