Struct libipld::cid::CidGeneric [−]
pub struct CidGeneric<S> where
S: Size, { /* fields omitted */ }
Expand description
Representation of a CID.
The generic is about the allocated size of the multihash.
Implementations
impl<S> Cid<S> where
S: Size,
impl<S> Cid<S> where
S: Size,
pub fn new(
version: Version,
codec: u64,
hash: Multihash<S>
) -> Result<Cid<S>, Error>
pub fn new(
version: Version,
codec: u64,
hash: Multihash<S>
) -> Result<Cid<S>, Error>
Create a new CID.
pub fn read_bytes<R>(r: R) -> Result<Cid<S>, Error> where
R: Read,
pub fn read_bytes<R>(r: R) -> Result<Cid<S>, Error> where
R: Read,
Reads the bytes from a byte stream.
pub fn write_bytes<W>(&self, w: W) -> Result<(), Error> where
W: Write,
pub fn write_bytes<W>(&self, w: W) -> Result<(), Error> where
W: Write,
Writes the bytes to a byte stream.
pub fn to_string_of_base(&self, base: Base) -> Result<String, Error>
pub fn to_string_of_base(&self, base: Base) -> Result<String, Error>
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
impl<T> AsRef<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Link<T>
[src]
impl<T> AsRef<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Link<T>
[src]impl<S> AsRef<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Block<S>
[src]
impl<S> AsRef<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Block<S>
[src]impl<S> Borrow<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Block<S>
[src]
impl<S> Borrow<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Block<S>
[src]impl Decode<DagCborCodec> for Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
[src]
impl Decode<DagCborCodec> for Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
[src]impl Encode<DagCborCodec> for Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
[src]
impl Encode<DagCborCodec> for Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
[src]impl<'_> From<&'_ Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Ipld
[src]
impl<'_> From<&'_ Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Ipld
[src]impl<'a> From<&'a Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for DagPath<'a>
[src]
impl<'a> From<&'a Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for DagPath<'a>
[src]impl<T> From<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Link<T>
[src]
impl<T> From<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Link<T>
[src]impl From<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Ipld
[src]
impl From<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>> for Ipld
[src]impl<S> Ord for Cid<S> where
S: Ord + Size,
impl<S> Ord for Cid<S> where
S: Ord + Size,
impl<S> PartialOrd<Cid<S>> for Cid<S> where
S: PartialOrd<S> + Size,
impl<S> PartialOrd<Cid<S>> for Cid<S> where
S: PartialOrd<S> + Size,
pub fn partial_cmp(&self, other: &Cid<S>) -> Option<Ordering>
pub fn partial_cmp(&self, other: &Cid<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<S> Copy for Cid<S> where
S: Size,
<S as ArrayLength<u8>>::ArrayType: Copy,
S: Size,
<S as ArrayLength<u8>>::ArrayType: Copy,
impl<S> Eq for Cid<S> where
S: Eq + Size,
S: Eq + Size,
impl<S> StructuralEq for Cid<S> where
S: Size,
S: Size,
impl<S> StructuralPartialEq for Cid<S> where
S: Size,
S: Size,
Auto Trait Implementations
impl<S> RefUnwindSafe for Cid<S> where
<S as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
<S as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<S> Send for Cid<S>
impl<S> Sync for Cid<S>
impl<S> Unpin for Cid<S> where
<S as ArrayLength<u8>>::ArrayType: Unpin,
<S as ArrayLength<u8>>::ArrayType: Unpin,
impl<S> UnwindSafe for Cid<S> where
<S as ArrayLength<u8>>::ArrayType: UnwindSafe,
<S as ArrayLength<u8>>::ArrayType: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> References<RawCodec> for T
[src]
impl<T> References<RawCodec> for T
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DagCbor for T where
T: Encode<DagCborCodec> + Decode<DagCborCodec>,
[src]
T: Encode<DagCborCodec> + Decode<DagCborCodec>,