Struct cid::Cid
[−]
[src]
pub struct Cid {
pub version: u64,
pub codec: Codec,
pub hash: Vec<u8>,
}Representation of a CID.
Fields
version: u64
codec: Codec
hash: Vec<u8>
Methods
impl Cid[src]
fn new(codec: Codec, version: u64, hash: Vec<u8>) -> Cid
Create a new CID.
fn new_from_prefix(prefix: &Prefix, data: &[u8]) -> Cid
Create a new CID from a prefix and some data.
fn as_bytes(&self) -> Vec<u8>
fn prefix(&self) -> Prefix
Trait Implementations
impl PartialEq for Cid[src]
fn eq(&self, __arg_0: &Cid) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Cid) -> bool
This method tests for !=.
impl Eq for Cid[src]
impl Clone for Cid[src]
fn clone(&self) -> Cid
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl Debug for Cid[src]
impl TryFrom<Vec<u8>> for Cid[src]
type Err = Error
fn try_from(data: Vec<u8>) -> Result<Self, Self::Err>
Create a Cid from a u8 vector.
impl TryFrom<String> for Cid[src]
impl<'a> TryFrom<&'a str> for Cid[src]
type Err = Error
fn try_from(data: &str) -> Result<Self, Self::Err>
Create a Cid from a string slice.
impl<'a> TryFrom<&'a [u8]> for Cid[src]
type Err = Error
fn try_from(data: &[u8]) -> Result<Self, Self::Err>
Create a Cid from a byte slice.