Trait Codec
libipld_core::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.
type Error: Error + Send + 'static
Error type.
const CODE: Code
Codec 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>
impl Codec for Raw
type Error = RawError