[]Struct ipld_block_builder::cid::CidGeneric

pub struct CidGeneric<C, H> where
    C: Into<u64> + TryFrom<u64> + Copy,
    H: Into<u64> + TryFrom<u64> + Copy
{ /* fields omitted */ }

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

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>

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

impl<C, H> Debug for CidGeneric<C, H> where
    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

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

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

impl<'_> From<&'_ CidGeneric<Codec, Code>> for Ipld

impl<'a> From<&'a CidGeneric<Codec, Code>> for DagPath<'a>[src]

impl From<CidGeneric<Codec, Code>> for 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

type Err = Error

The associated error which can be returned from parsing.

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

impl<C, H> Ord for CidGeneric<C, H> where
    C: Ord + Into<u64> + TryFrom<u64> + Copy,
    H: Ord + Into<u64> + TryFrom<u64> + Copy

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

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

impl<C, H> StructuralEq for CidGeneric<C, H> where
    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

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

type Error = Error

The type returned in the event of a conversion 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

type Error = Error

The type returned in the event of a conversion 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

type Error = Error

The type returned in the event of a conversion 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

type Error = Error

The type returned in the event of a conversion error.

impl TryReadCbor for CidGeneric<Codec, Code>

Auto Trait Implementations

impl<C, H> RefUnwindSafe for CidGeneric<C, H> where
    C: RefUnwindSafe,
    H: RefUnwindSafe

impl<C, H> Send for CidGeneric<C, H> where
    C: Send,
    H: Send

impl<C, H> Sync for CidGeneric<C, H> where
    C: Sync,
    H: Sync

impl<C, H> Unpin for CidGeneric<C, H> where
    C: Unpin,
    H: Unpin

impl<C, H> UnwindSafe for CidGeneric<C, H> where
    C: UnwindSafe,
    H: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.