[−][src]Trait declio::Encode
A type that can be encoded into a byte stream.
Required methods
fn encode<W>(&self, ctx: Ctx, writer: &mut W) -> Result<(), Error> where
W: Write,
W: Write,
Encodes &self
to the given writer.
Implementations on Foreign Types
impl<T, Ctx, '_> Encode<Ctx> for &'_ T where
T: Encode<Ctx>,
[src]
T: Encode<Ctx>,
impl<T, Ctx> Encode<Ctx> for [T] where
T: Encode<Ctx>,
Ctx: Clone,
[src]
T: Encode<Ctx>,
Ctx: Clone,
fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Encodes each element of the slice in order.
If length is also to be encoded, it has to be done separately.
impl<T, Ctx> Encode<Ctx> for Vec<T> where
T: Encode<Ctx>,
Ctx: Clone,
[src]
T: Encode<Ctx>,
Ctx: Clone,
fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Encodes each element of the vector in order.
If length is also to be encoded, it has to be done separately.
impl<T, Ctx> Encode<Ctx> for Option<T> where
T: Encode<Ctx>,
[src]
T: Encode<Ctx>,
fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
If Some
, then the inner value is encoded, otherwise, nothing is written.
impl<'a, T: ?Sized, Ctx> Encode<Ctx> for Cow<'a, T> where
T: Encode<Ctx> + ToOwned,
[src]
T: Encode<Ctx> + ToOwned,
fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Borrows a value of type T
and encodes it.
impl<T, Ctx> Encode<Ctx> for Box<T> where
T: Encode<Ctx>,
[src]
T: Encode<Ctx>,
fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Encodes the boxed value.
impl Encode<()> for ()
[src]
impl Encode<()> for bool
[src]
fn encode<W>(&self, _: (), writer: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Encodes true
as a 1-byte, false
as a 0-byte.