Trait libipld::prelude::Encode[][src]

pub trait Encode<C> where
    C: Codec
{ fn encode<W>(&self, c: C, w: &mut W) -> Result<(), Error>
    where
        W: Write
; }
Expand description

Encode trait.

This trait is generic over a codec, so that different codecs can be implemented for the same type.

Required methods

fn encode<W>(&self, c: C, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

Encodes into a impl Write.

It takes a specific codec as parameter, so that the Encode can be generic over an enum that contains multiple codecs.

Implementations on Foreign Types

impl Encode<DagCborCodec> for bool[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for u16[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for [u8][src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for i64[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for str[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<A, B, C> Encode<DagCborCodec> for (A, B, C) where
    C: Encode<DagCborCodec>,
    A: Encode<DagCborCodec>,
    B: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<A, B> Encode<DagCborCodec> for (A, B) where
    A: Encode<DagCborCodec>,
    B: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<T> Encode<DagCborCodec> for Arc<T> where
    T: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for u8[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for i32[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<K, T> Encode<DagCborCodec> for BTreeMap<K, T> where
    T: 'static + Encode<DagCborCodec>,
    K: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for f64[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<A> Encode<DagCborCodec> for (A,) where
    A: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for i128[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<A, B, C, D> Encode<DagCborCodec> for (A, B, C, D) where
    C: Encode<DagCborCodec>,
    A: Encode<DagCborCodec>,
    B: Encode<DagCborCodec>,
    D: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for i8[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for u32[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<T> Encode<DagCborCodec> for Vec<T, Global> where
    T: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for ()[src]

pub fn encode<W>(&self, _c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for f32[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for u64[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for Box<[u8], Global>[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<T> Encode<DagCborCodec> for Option<T> where
    T: Encode<DagCborCodec>, 
[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for String[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for i16[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<RawCodec> for Box<[u8], Global>[src]

pub fn encode<W>(&self, RawCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<'_, C, T> Encode<C> for &'_ T where
    C: Codec,
    T: Encode<C>, 
[src]

pub fn encode<W>(&self, c: C, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<RawCodec> for Vec<u8, Global>[src]

pub fn encode<W>(&self, RawCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<RawCodec> for [u8][src]

pub fn encode<W>(&self, RawCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

Implementors

impl Encode<IpldCodec> for Ipld[src]

fn encode<W: Write>(&self, c: IpldCodec, w: &mut W) -> Result<()>[src]

impl Encode<RawCodec> for Ipld[src]

pub fn encode<W>(&self, c: RawCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for Ipld[src]

pub fn encode<W>(&self, c: DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagCborCodec> for Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>[src]

pub fn encode<W>(&self, DagCborCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagJsonCodec> for Ipld[src]

pub fn encode<W>(&self, DagJsonCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl Encode<DagPbCodec> for Ipld[src]

pub fn encode<W>(&self, DagPbCodec, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<C> Encode<C> for RawValue<C> where
    C: Codec
[src]

pub fn encode<W>(&self, C, w: &mut W) -> Result<(), Error> where
    W: Write
[src]

impl<C, T> Encode<C> for Link<T> where
    C: Codec,
    Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>: Encode<C>, 
[src]

pub fn encode<W>(&self, c: C, w: &mut W) -> Result<(), Error> where
    W: Write
[src]