Encode

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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 Cid<64>

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<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§