[go: up one dir, main page]

[][src]Struct cid::Cid

pub struct Cid { /* fields omitted */ }

Representation of a CID.

Methods

impl Cid[src]

pub fn new_v0(hash: Multihash) -> Result<Cid>[src]

Create a new CIDv0.

pub fn new_v1(codec: Codec, hash: Multihash) -> Cid[src]

Create a new CIDv1.

pub fn new(version: Version, codec: Codec, hash: Multihash) -> Result<Cid>[src]

Create a new CID.

pub fn new_from_prefix(prefix: &Prefix, data: &[u8]) -> Cid[src]

Create a new CID from a prefix and some data.

pub fn version(&self) -> Version[src]

Returns the cid version.

pub fn codec(&self) -> Codec[src]

Returns the cid codec.

pub fn hash(&self) -> MultihashRef[src]

Returns the cid multihash.

pub fn to_bytes(&self) -> Vec<u8>[src]

Convert CID to encoded bytes.

pub fn prefix(&self) -> Prefix[src]

Return the prefix of the CID.

Trait Implementations

impl Clone for Cid[src]

impl Debug for Cid[src]

impl Display for Cid[src]

impl Eq for Cid[src]

impl<'_> From<&'_ Cid> for Cid[src]

impl From<Cid> for Vec<u8>[src]

impl From<Cid> for String[src]

impl FromStr for Cid[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for Cid[src]

impl Ord for Cid[src]

impl PartialEq<Cid> for Cid[src]

impl PartialOrd<Cid> for Cid[src]

impl StructuralEq for Cid[src]

impl StructuralPartialEq for Cid[src]

impl<'_> TryFrom<&'_ [u8]> for Cid[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ str> for Cid[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<String> for Cid[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Vec<u8>> for Cid[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Cid

impl Send for Cid

impl Sync for Cid

impl Unpin for Cid

impl UnwindSafe for Cid

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,