Trait Decoder

Source
pub trait Decoder {
    type Codec: Codec;

    // Required method
    fn decode<T: Decode<Self::Codec>>(
        &self,
        cid: &Cid,
        data: &[u8],
    ) -> Result<T>;
}
Expand description

Decoder trait.

Required Associated Types§

Source

type Codec: Codec

Ipld codec.

Required Methods§

Source

fn decode<T: Decode<Self::Codec>>(&self, cid: &Cid, data: &[u8]) -> Result<T>

Decodes the block into a value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C: Codec, H> Decoder for GenericCodec<C, H>

Source§

type Codec = C