pub struct Link<T> { /* private fields */ }
Expand description
Typed cid.
Implementations§
Methods from Deref<Target = Cid<64>>§
sourcepub fn write_bytes<W>(&self, w: W) -> Result<usize, Error>where
W: Write,
pub fn write_bytes<W>(&self, w: W) -> Result<usize, Error>where
W: Write,
Writes the bytes to a byte stream, returns the number of bytes written.
sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the length in bytes needed to encode this cid into bytes.
sourcepub 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§
source§impl<T> Ord for Link<T>
impl<T> Ord for Link<T>
source§impl<T> PartialEq for Link<T>
impl<T> PartialEq for Link<T>
source§impl<T> PartialOrd for Link<T>
impl<T> PartialOrd for Link<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T> Copy for Link<T>
impl<T> Eq for Link<T>
Auto Trait Implementations§
impl<T> Freeze for Link<T>
impl<T> RefUnwindSafe for Link<T>where
T: RefUnwindSafe,
impl<T> Send for Link<T>where
T: Send,
impl<T> Sync for Link<T>where
T: Sync,
impl<T> Unpin for Link<T>where
T: Unpin,
impl<T> UnwindSafe for Link<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)