pub enum Object {
Atom(Atom),
Node(Node),
}Expand description
An Object is either an Atom (leaf) or a Node (container). This is the fundamental unit of state storage in AgentStateGraph.
Variants§
Implementations§
Source§impl Object
impl Object
Sourcepub fn canonical_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_bytes(&self) -> Vec<u8> ⓘ
Compute the canonical serialization of this object. The serialization is deterministic: map keys are sorted, sets are sorted by ObjectId, and numeric types use fixed encoding.
pub fn null() -> Self
pub fn bool(v: bool) -> Self
pub fn int(v: i64) -> Self
pub fn float(v: f64) -> Self
Sourcepub fn from_json_number(n: &Number) -> Self
pub fn from_json_number(n: &Number) -> Self
The atom for a JSON number, exactly: Int when it fits i64,
UInt above i64::MAX, Float otherwise. Falling back to f64 for
every integer that missed i64 stored u64 ids and hashes as different
numbers.
pub fn string(v: impl Into<String>) -> Self
pub fn bytes(v: Vec<u8>) -> Self
pub fn map(entries: BTreeMap<String, ObjectId>) -> Self
pub fn empty_map() -> Self
pub fn list(items: Vec<ObjectId>) -> Self
pub fn set(items: Vec<ObjectId>) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Object
impl<'de> Deserialize<'de> for Object
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
impl StructuralPartialEq for Object
Auto Trait Implementations§
impl Freeze for Object
impl RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl UnsafeUnpin for Object
impl UnwindSafe for Object
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