[−]Struct ipld_block_builder::cid::CidGeneric
Representation of a CID.
Usually you would use Cid instead, unless you have a custom Multihash code table
Implementations
impl<C, H> CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
pub fn new_v0(hash: MultihashGeneric<H>) -> Result<CidGeneric<C, H>, Error>
Create a new CIDv0.
pub fn new_v1(codec: C, hash: MultihashGeneric<H>) -> CidGeneric<C, H>
Create a new CIDv1.
pub fn new(
version: Version,
codec: C,
hash: MultihashGeneric<H>
) -> Result<CidGeneric<C, H>, Error>
version: Version,
codec: C,
hash: MultihashGeneric<H>
) -> Result<CidGeneric<C, H>, Error>
Create a new CID.
pub fn version(&self) -> Version
Returns the cid version.
pub fn codec(&self) -> C
Returns the cid codec.
pub fn hash(&self) -> MultihashRefGeneric<H>
Returns the cid multihash.
pub fn to_bytes(&self) -> Vec<u8>
Convert CID to encoded bytes.
Trait Implementations
impl<C, H> Clone for CidGeneric<C, H> where
C: Clone + Into<u64> + TryFrom<u64> + Copy,
H: Clone + Into<u64> + TryFrom<u64> + Copy,
C: Clone + Into<u64> + TryFrom<u64> + Copy,
H: Clone + Into<u64> + TryFrom<u64> + Copy,
fn clone(&self) -> CidGeneric<C, H>
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<C, H> Debug for CidGeneric<C, H> where
C: Debug + Into<u64> + TryFrom<u64> + Copy,
H: Debug + Into<u64> + TryFrom<u64> + Copy,
C: Debug + Into<u64> + TryFrom<u64> + Copy,
H: Debug + Into<u64> + TryFrom<u64> + Copy,
impl Decode<DagCbor> for CidGeneric<Codec, Code>
impl<C, H> Display for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
impl Encode<DagCbor> for CidGeneric<Codec, Code>
impl<C, H> Eq for CidGeneric<C, H> where
C: Eq + Into<u64> + TryFrom<u64> + Copy,
H: Eq + Into<u64> + TryFrom<u64> + Copy,
C: Eq + Into<u64> + TryFrom<u64> + Copy,
H: Eq + Into<u64> + TryFrom<u64> + Copy,
impl<'_, C, H> From<&'_ CidGeneric<C, H>> for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
fn from(cid: &CidGeneric<C, H>) -> CidGeneric<C, H>
impl<'_> From<&'_ CidGeneric<Codec, Code>> for Ipld
fn from(t: &CidGeneric<Codec, Code>) -> Ipld
impl<'a> From<&'a CidGeneric<Codec, Code>> for DagPath<'a>[src]
impl From<CidGeneric<Codec, Code>> for Ipld
fn from(t: CidGeneric<Codec, Code>) -> Ipld
impl<C, H> FromStr for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
type Err = Error
The associated error which can be returned from parsing.
fn from_str(cid_str: &str) -> Result<CidGeneric<C, H>, Error>
impl<C, H> Hash for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
fn hash<T>(&self, state: &mut T) where
T: Hasher,
T: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<C, H> Ord for CidGeneric<C, H> where
C: Ord + Into<u64> + TryFrom<u64> + Copy,
H: Ord + Into<u64> + TryFrom<u64> + Copy,
C: Ord + Into<u64> + TryFrom<u64> + Copy,
H: Ord + Into<u64> + TryFrom<u64> + Copy,
fn cmp(&self, other: &CidGeneric<C, H>) -> Ordering
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl<C, H> PartialEq<CidGeneric<C, H>> for CidGeneric<C, H> where
C: PartialEq<C> + Into<u64> + TryFrom<u64> + Copy,
H: PartialEq<H> + Into<u64> + TryFrom<u64> + Copy,
C: PartialEq<C> + Into<u64> + TryFrom<u64> + Copy,
H: PartialEq<H> + Into<u64> + TryFrom<u64> + Copy,
fn eq(&self, other: &CidGeneric<C, H>) -> bool
fn ne(&self, other: &CidGeneric<C, H>) -> bool
impl<C, H> PartialOrd<CidGeneric<C, H>> for CidGeneric<C, H> where
C: PartialOrd<C> + Into<u64> + TryFrom<u64> + Copy,
H: PartialOrd<H> + Into<u64> + TryFrom<u64> + Copy,
C: PartialOrd<C> + Into<u64> + TryFrom<u64> + Copy,
H: PartialOrd<H> + Into<u64> + TryFrom<u64> + Copy,
fn partial_cmp(&self, other: &CidGeneric<C, H>) -> Option<Ordering>
fn lt(&self, other: &CidGeneric<C, H>) -> bool
fn le(&self, other: &CidGeneric<C, H>) -> bool
fn gt(&self, other: &CidGeneric<C, H>) -> bool
fn ge(&self, other: &CidGeneric<C, H>) -> bool
impl<C, H> StructuralEq for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
impl<C, H> StructuralPartialEq for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
impl<'_, C, H> TryFrom<&'_ [u8]> for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
type Error = Error
The type returned in the event of a conversion error.
fn try_from(bytes: &[u8]) -> Result<CidGeneric<C, H>, Error>
impl<'_, C, H> TryFrom<&'_ str> for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
type Error = Error
The type returned in the event of a conversion error.
fn try_from(cid_str: &str) -> Result<CidGeneric<C, H>, Error>
impl<C, H> TryFrom<String> for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
type Error = Error
The type returned in the event of a conversion error.
fn try_from(cid_str: String) -> Result<CidGeneric<C, H>, Error>
impl<C, H> TryFrom<Vec<u8>> for CidGeneric<C, H> where
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
C: Into<u64> + TryFrom<u64> + Copy,
H: Into<u64> + TryFrom<u64> + Copy,
<C as TryFrom<u64>>::Error: Debug,
<H as TryFrom<u64>>::Error: Debug,
type Error = Error
The type returned in the event of a conversion error.
fn try_from(bytes: Vec<u8>) -> Result<CidGeneric<C, H>, Error>
impl TryReadCbor for CidGeneric<Codec, Code>
fn try_read_cbor<R>(
r: &mut R,
major: u8
) -> Result<Option<CidGeneric<Codec, Code>>, Error> where
R: Read,
r: &mut R,
major: u8
) -> Result<Option<CidGeneric<Codec, Code>>, Error> where
R: Read,
Auto Trait Implementations
impl<C, H> RefUnwindSafe for CidGeneric<C, H> where
C: RefUnwindSafe,
H: RefUnwindSafe,
C: RefUnwindSafe,
H: RefUnwindSafe,
impl<C, H> Send for CidGeneric<C, H> where
C: Send,
H: Send,
C: Send,
H: Send,
impl<C, H> Sync for CidGeneric<C, H> where
C: Sync,
H: Sync,
C: Sync,
H: Sync,
impl<C, H> Unpin for CidGeneric<C, H> where
C: Unpin,
H: Unpin,
C: Unpin,
H: Unpin,
impl<C, H> UnwindSafe for CidGeneric<C, H> where
C: UnwindSafe,
H: UnwindSafe,
C: UnwindSafe,
H: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,