pub enum TypedValue {
Int(i64),
Float(f64),
Bool(bool),
String(String),
Map(BTreeMap<TypedMapKey, TypedValue>),
Variant {
tag: u32,
fields: Vec<TypedValue>,
},
}Expand description
Serializable representation of Seq Values
This type mirrors Value but uses owned data suitable for serialization.
Quotations and closures cannot be serialized (they contain code, not data).
Variants§
Int(i64)
Float(f64)
Bool(bool)
String(String)
Map(BTreeMap<TypedMapKey, TypedValue>)
Map with typed keys and values
Variant
Variant with tag and fields
Implementations§
Source§impl TypedValue
impl TypedValue
Sourcepub fn from_value(value: &Value) -> Result<Self, SerializeError>
pub fn from_value(value: &Value) -> Result<Self, SerializeError>
Convert from runtime Value
Returns error if Value contains:
- Code (Quotation/Closure) - not serializable
- Non-finite floats (NaN/Infinity) - could cause logic issues
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
Convert to runtime Value
Note: Strings are allocated as global strings (not arena) to ensure they outlive any strand context.
Sourcepub fn to_map_key(&self) -> Result<TypedMapKey, SerializeError>
pub fn to_map_key(&self) -> Result<TypedMapKey, SerializeError>
Try to convert to a map key (fails for Float, Map, Variant)
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, SerializeError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, SerializeError>
Deserialize from binary format (bincode)
Sourcepub fn to_debug_string(&self) -> String
pub fn to_debug_string(&self) -> String
Convert to human-readable debug string
Trait Implementations§
Source§impl Clone for TypedValue
impl Clone for TypedValue
Source§fn clone(&self) -> TypedValue
fn clone(&self) -> TypedValue
Returns a duplicate of the value. Read more
1.0.0 · 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 TypedValue
impl Debug for TypedValue
Source§impl<'de> Deserialize<'de> for TypedValue
impl<'de> Deserialize<'de> for TypedValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for TypedValue
impl PartialEq for TypedValue
Source§impl Serialize for TypedValue
impl Serialize for TypedValue
impl StructuralPartialEq for TypedValue
Auto Trait Implementations§
impl Freeze for TypedValue
impl RefUnwindSafe for TypedValue
impl Send for TypedValue
impl Sync for TypedValue
impl Unpin for TypedValue
impl UnwindSafe for TypedValue
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