Struct ipld_dagpb::DagPbCodec

source ·
pub struct DagPbCodec;
Expand description

DAG-PB implementation of ipld-core’s Codec trait.

Trait Implementations§

source§

impl Codec<Ipld> for DagPbCodec

source§

const CODE: u64 = 112u64

The multicodec code of the IPLD codec.
§

type Error = Error

The error that is returned if encoding or decoding fails.
source§

fn decode<R: BufRead>(reader: R) -> Result<Ipld, Self::Error>

Decode a reader into the desired type.
source§

fn encode<W: Write>(writer: W, data: &Ipld) -> Result<(), Self::Error>

Encode a type into a writer.
source§

fn decode_from_slice(bytes: &[u8]) -> Result<T, Self::Error>

Decode a slice into the desired type.
source§

fn encode_to_vec(data: &T) -> Result<Vec<u8>, Self::Error>

Encode a type into bytes.
source§

impl Codec<PbNode> for DagPbCodec

source§

const CODE: u64 = 112u64

The multicodec code of the IPLD codec.
§

type Error = Error

The error that is returned if encoding or decoding fails.
source§

fn decode<R: BufRead>(reader: R) -> Result<PbNode, Self::Error>

Decode a reader into the desired type.
source§

fn encode<W: Write>(writer: W, data: &PbNode) -> Result<(), Self::Error>

Encode a type into a writer.
source§

fn decode_from_slice(bytes: &[u8]) -> Result<T, Self::Error>

Decode a slice into the desired type.
source§

fn encode_to_vec(data: &T) -> Result<Vec<u8>, Self::Error>

Encode a type into bytes.
§

type LinksError = Error

The error that is returned if the link extraction fails.
Return all links (CIDs) that the given encoded data contains.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.