pub struct ObjectId(/* private fields */);Expand description
A 256-bit BLAKE3 content hash serving as the immutable identity of a Knowledge Object.
oid = BLAKE3(canonical_serialization(payload + edges + embeddings))
Properties:
- Deterministic: Same content always produces the same OID.
- Collision-resistant: 256-bit output makes collisions computationally infeasible.
- Structural deduplication: Identical objects share the same OID.
- Content verification: Recomputing the hash detects corruption or tampering.
The OID is computed over the canonical byte representation (sorted keys, normalized floats) to ensure deterministic hashing regardless of insertion order.
Implementations§
Source§impl ObjectId
impl ObjectId
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Create an OID from a raw 32-byte hash.
Sourcepub fn from_content(content: &[u8]) -> Self
pub fn from_content(content: &[u8]) -> Self
Compute the OID from canonical content bytes using BLAKE3.
Sourcepub fn from_hex(s: &str) -> Result<Self, ObjectIdError>
pub fn from_hex(s: &str) -> Result<Self, ObjectIdError>
Parse an OID from a 64-character hex string.
Trait Implementations§
impl Copy for ObjectId
Source§impl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
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 Eq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
impl Freeze for ObjectId
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnsafeUnpin for ObjectId
impl UnwindSafe for ObjectId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.