pub struct ContentCid(/* private fields */);Expand description
Canonical CIDv1 envelope for an object-plane key.
The CID carries both the content domain (multicodec) and hash algorithm (multihash). Keeping the complete envelope at crate boundaries prevents equal-width digests such as an XET MerkleHash and SHA-256 from being silently reinterpreted as one another.
Implementations§
Source§impl ContentCid
impl ContentCid
Sourcepub fn new(cid: impl Into<String>) -> Result<Self>
pub fn new(cid: impl Into<String>) -> Result<Self>
Parse and validate a canonical CID understood by hyprstream.
The input is re-encoded to the canonical lowercase base32 text before
being stored: base32 decoding is case-insensitive, so equivalent
spellings must collapse to one representation — Eq/Hash and the
rendezvous derivation all operate on the string form.
Sourcepub fn git_sha256(hash: &Sha256Hash) -> Result<Self>
pub fn git_sha256(hash: &Sha256Hash) -> Result<Self>
Address a raw Git object by its SHA-256 digest.
Sourcepub fn xet_merkle(hash: &[u8]) -> Result<Self>
pub fn xet_merkle(hash: &[u8]) -> Result<Self>
Address a XET file reconstruction DAG by its real keyed-BLAKE3 Merkle hash.
Trait Implementations§
Source§impl Clone for ContentCid
impl Clone for ContentCid
Source§fn clone(&self) -> ContentCid
fn clone(&self) -> ContentCid
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContentCid
impl Debug for ContentCid
Source§impl<'de> Deserialize<'de> for ContentCid
Route deserialization through ContentCid::new so every ingress path
validates and canonicalizes — a transparent derive would accept arbitrary
strings verbatim.
impl<'de> Deserialize<'de> for ContentCid
Route deserialization through ContentCid::new so every ingress path
validates and canonicalizes — a transparent derive would accept arbitrary
strings verbatim.
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>,
Source§impl Display for ContentCid
impl Display for ContentCid
Source§impl Hash for ContentCid
impl Hash for ContentCid
Source§impl PartialEq for ContentCid
impl PartialEq for ContentCid
Source§fn eq(&self, other: &ContentCid) -> bool
fn eq(&self, other: &ContentCid) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ContentCid
impl Serialize for ContentCid
impl Eq for ContentCid
impl StructuralPartialEq for ContentCid
Auto Trait Implementations§
impl Freeze for ContentCid
impl RefUnwindSafe for ContentCid
impl Send for ContentCid
impl Sync for ContentCid
impl Unpin for ContentCid
impl UnsafeUnpin for ContentCid
impl UnwindSafe for ContentCid
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
§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more