Struct cid::CidGeneric [−][src]
pub struct CidGeneric<S: Size> { /* fields omitted */ }Expand description
Representation of a CID.
The generic is about the allocated size of the multihash.
Implementations
Reads the bytes from a byte stream.
Writes the bytes to a byte stream.
Convert CID into a multibase encoded string
Example
use cid::Cid;
use multibase::Base;
use multihash::{Code, MultihashDigest};
const RAW: u64 = 0x55;
let cid = Cid::new_v1(RAW, Code::Sha2_256.digest(b"foo"));
let encoded = cid.to_string_of_base(Base::Base64).unwrap();
assert_eq!(encoded, "mAVUSICwmtGto/8aP+ZtFPB0wQTQTQi1wZIO/oPmKXohiZueu");Trait Implementations
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl<S> RefUnwindSafe for Cid<S> where
<S as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<S> UnwindSafe for Cid<S> where
<S as ArrayLength<u8>>::ArrayType: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more