pub struct ContentDigest(/* private fields */);Expand description
A bare BLAKE3 content digest, encoded as lowercase hex.
- What is hashed: exactly the raw bytes handed to
ContentDigest::of(for documents: the source bytes). Path, title, and metadata are never included. - Algorithm: BLAKE3, 32-byte output.
- Encoding: 64 lowercase hexadecimal characters. This is the serialized representation everywhere (Display, JSON, CBOR).
- Not a CID: no multibase/multicodec/multihash structure.
Stable across serialization formats (JSON, CBOR). Two ContentDigests
are equal iff the content they identify is byte-for-byte identical.
Implementations§
Source§impl ContentDigest
impl ContentDigest
Sourcepub fn of(content: &[u8]) -> Self
pub fn of(content: &[u8]) -> Self
Computes the BLAKE3 digest of content (the raw bytes, nothing else).
Sourcepub fn from_hex(s: &str) -> Result<Self, ScrybeError>
pub fn from_hex(s: &str) -> Result<Self, ScrybeError>
Parses a digest from its hex encoding.
Accepts exactly 64 ASCII hex characters; uppercase
input is normalized to the canonical lowercase form. Anything else
(wrong length, non-hex characters) is rejected with
ScrybeError::InvalidDigest.
Trait Implementations§
Source§impl Clone for ContentDigest
impl Clone for ContentDigest
Source§fn clone(&self) -> ContentDigest
fn clone(&self) -> ContentDigest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ContentDigest
impl Debug for ContentDigest
Source§impl<'de> Deserialize<'de> for ContentDigest
impl<'de> Deserialize<'de> for ContentDigest
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 Display for ContentDigest
impl Display for ContentDigest
impl Eq for ContentDigest
Source§impl FromStr for ContentDigest
impl FromStr for ContentDigest
Source§impl Hash for ContentDigest
impl Hash for ContentDigest
Source§impl PartialEq for ContentDigest
impl PartialEq for ContentDigest
Source§impl Serialize for ContentDigest
impl Serialize for ContentDigest
impl StructuralPartialEq for ContentDigest
Auto Trait Implementations§
impl Freeze for ContentDigest
impl RefUnwindSafe for ContentDigest
impl Send for ContentDigest
impl Sync for ContentDigest
impl Unpin for ContentDigest
impl UnsafeUnpin for ContentDigest
impl UnwindSafe for ContentDigest
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