Trait libipld::prelude::Encode

source ·
pub trait Encode<C>
where C: Codec,
{ // Required method 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§

source

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

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Encode<DagCborCodec> for bool

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for f32

source§

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

source§

impl Encode<DagCborCodec> for f64

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for i8

source§

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

source§

impl Encode<DagCborCodec> for i16

source§

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

source§

impl Encode<DagCborCodec> for i32

source§

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

source§

impl Encode<DagCborCodec> for i64

source§

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

source§

impl Encode<DagCborCodec> for i128

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for str

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for u8

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for u16

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for u32

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for u64

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<DagCborCodec> for ()

source§

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

source§

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

source§

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

source§

impl Encode<DagCborCodec> for String

source§

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

source§

impl Encode<DagCborCodec> for [u8]

source§

fn encode<W>(&self, _: DagCborCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

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

source§

fn encode<W>(&self, _: RawCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<RawCodec> for Vec<u8>

source§

fn encode<W>(&self, _: RawCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

impl Encode<RawCodec> for [u8]

source§

fn encode<W>(&self, _: RawCodec, w: &mut W) -> Result<(), Error>
where W: Write,

source§

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

source§

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

source§

impl<A, B> Encode<DagCborCodec> for (A, B)

source§

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

source§

impl<A, B, C> Encode<DagCborCodec> for (A, B, C)

source§

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

source§

impl<A, B, C, D> Encode<DagCborCodec> for (A, B, C, D)

source§

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

source§

impl<C, T> Encode<C> for &T
where C: Codec, T: Encode<C>,

source§

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

source§

impl<T> Encode<DagCborCodec> for Option<T>
where T: Encode<DagCborCodec>,

source§

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

source§

impl<T> Encode<DagCborCodec> for BTreeMap<String, T>
where T: Encode<DagCborCodec> + 'static,

source§

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

source§

impl<T> Encode<DagCborCodec> for Arc<T>
where T: Encode<DagCborCodec>,

source§

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

source§

impl<T> Encode<DagCborCodec> for Vec<T>
where T: Encode<DagCborCodec>,

source§

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

Implementors§

source§

impl Encode<IpldCodec> for Ipld

source§

impl Encode<DagCborCodec> for Ipld

source§

impl Encode<DagCborCodec> for Cid<64>

source§

impl Encode<DagJsonCodec> for Ipld

source§

impl Encode<RawCodec> for Ipld

source§

impl<C> Encode<C> for RawValue<C>
where C: Codec,

source§

impl<C, T> Encode<C> for Link<T>
where C: Codec, Cid<64>: Encode<C>,