[][src]Struct forest_cid::Cid

pub struct Cid {
    pub version: Version,
    pub codec: Codec,
    pub hash: Multihash,
}

Representation of a IPLD CID.

Fields

version: Versioncodec: Codechash: Multihash

Implementations

impl Cid[src]

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

Create a new CID.

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

Create a new v1 CID.

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

Create a new v0 CID.

pub fn new_from_cbor<T: MultihashDigest>(bz: &[u8], hash: T) -> Self[src]

Constructs a cid with bytes using default version and codec

pub fn from_raw_cid<T: TryInto<Cid>>(data: T) -> Result<Cid, T::Error>[src]

Create a new CID from raw data (binary or multibase encoded string)

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

Create a new CID from a prefix and some data.

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

Returns encoded bytes of a cid

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

Returns prefix for Cid format

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

Returns cid in bytes to be stored in datastore

Trait Implementations

impl Clone for Cid[src]

impl Debug for Cid[src]

impl Default for Cid[src]

impl<'de> Deserialize<'de> for Cid[src]

impl Display for Cid[src]

impl Eq for Cid[src]

impl FromStr for Cid[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for Cid[src]

impl PartialEq<Cid> for Cid[src]

impl Serialize 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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.