[][src]Trait libipld_core::codec::Codec

pub trait Codec: Copy + Unpin + Send + Sync + 'static + Sized + TryFrom<u64, Error = UnsupportedCodec> + Into<u64> {
    fn decode_ipld(&self, bytes: &[u8]) -> Result<Ipld>;

    fn encode<T: Encode<Self> + ?Sized>(&self, obj: &T) -> Result<Box<[u8]>> { ... }
fn decode<T: Decode<Self>>(&self, bytes: &[u8]) -> Result<T> { ... } }

Codec trait.

Required methods

fn decode_ipld(&self, bytes: &[u8]) -> Result<Ipld>

Decode ipld.

Loading content...

Provided methods

fn encode<T: Encode<Self> + ?Sized>(&self, obj: &T) -> Result<Box<[u8]>>

Encodes an encodable type.

fn decode<T: Decode<Self>>(&self, bytes: &[u8]) -> Result<T>

Decodes a decodable type.

Loading content...

Implementors

impl Codec for RawCodec[src]

Loading content...