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

pub trait Codec: Sized {
    type Error: Error + Send + 'static;

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

Codec trait.

Associated Types

type Error: Error + Send + 'static

Error type.

Loading content...

Associated Constants

const CODE: Code

Codec code.

Loading content...

Provided methods

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

Encodes an encodable type.

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

Decodes a decodable type.

Loading content...

Implementors

impl Codec for RawCodec[src]

Loading content...