Trait libipld::prelude::Codec[][src]

pub trait Codec: 'static + Into<u64> + TryFrom<u64, Error = UnsupportedCodec> + Send + Copy + Sync + Unpin {
    pub fn encode<T>(&self, obj: &T) -> Result<Vec<u8, Global>, Error>
    where
        T: Encode<Self> + ?Sized
, { ... }
pub fn decode<T>(&self, bytes: &[u8]) -> Result<T, Error>
    where
        T: Decode<Self>
, { ... }
pub fn references<T, E>(
        &self,
        bytes: &[u8],
        set: &mut E
    ) -> Result<(), Error>
    where
        T: References<Self>,
        E: Extend<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>
, { ... } }

Codec trait.

Provided methods

pub fn encode<T>(&self, obj: &T) -> Result<Vec<u8, Global>, Error> where
    T: Encode<Self> + ?Sized
[src]

Encodes an encodable type.

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

Decodes a decodable type.

pub fn references<T, E>(&self, bytes: &[u8], set: &mut E) -> Result<(), Error> where
    T: References<Self>,
    E: Extend<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>, 
[src]

Scrapes the references.

Loading content...

Implementations on Foreign Types

impl Codec for DagCborCodec[src]

impl Codec for DagJsonCodec[src]

impl Codec for DagPbCodec[src]

Loading content...

Implementors

Loading content...