Trait libipld_core::codec::Decode

source ·
pub trait Decode<C: Codec>: Sized {
    // Required method
    fn decode<R: Read + Seek>(c: C, r: &mut R) -> Result<Self>;
}
Expand description

Decode trait.

This trait is generic over a codec, so that different codecs can be implemented for the same type.

Required Methods§

source

fn decode<R: Read + Seek>(c: C, r: &mut R) -> Result<Self>

Decode from an impl Read.

It takes a specific codec as parameter, so that the Decode can be generic over an enum that contains multiple codecs.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Decode<RawCodec> for Box<[u8]>

source§

fn decode<R: Read + Seek>(c: RawCodec, r: &mut R) -> Result<Self>

source§

impl Decode<RawCodec> for Vec<u8>

source§

fn decode<R: Read + Seek>(_: RawCodec, r: &mut R) -> Result<Self>

Implementors§

source§

impl Decode<RawCodec> for Ipld

source§

impl<C: Codec + SkipOne> Decode<C> for IgnoredAny

source§

impl<C: Codec + SkipOne> Decode<C> for RawValue<C>

source§

impl<C: Codec, T> Decode<C> for Link<T>
where Cid: Decode<C>,