[][src]Trait declio::Encode

pub trait Encode<Ctx = ()> {
    fn encode<W>(&self, ctx: Ctx, writer: &mut W) -> Result<(), Error>
    where
        W: Write
; }

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

Encodes &self to the given writer.

Loading content...

Implementations on Foreign Types

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

impl<T, Ctx> Encode<Ctx> for [T] where
    T: Encode<Ctx>,
    Ctx: Clone
[src]

fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
    W: Write
[src]

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]

fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
    W: Write
[src]

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]

fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
    W: Write
[src]

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]

fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
    W: Write
[src]

Borrows a value of type T and encodes it.

impl<T, Ctx> Encode<Ctx> for Box<T> where
    T: Encode<Ctx>, 
[src]

fn encode<W>(&self, inner_ctx: Ctx, writer: &mut W) -> Result<(), Error> where
    W: Write
[src]

Encodes the boxed value.

impl Encode<()> for ()[src]

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

No-op.

impl Encode<()> for bool[src]

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

Encodes true as a 1-byte, false as a 0-byte.

impl Encode<Endian> for u8[src]

impl Encode<()> for u8[src]

impl Encode<Endian> for u16[src]

impl Encode<()> for u16[src]

impl Encode<Endian> for u32[src]

impl Encode<()> for u32[src]

impl Encode<Endian> for u64[src]

impl Encode<()> for u64[src]

impl Encode<Endian> for u128[src]

impl Encode<()> for u128[src]

impl Encode<Endian> for i8[src]

impl Encode<()> for i8[src]

impl Encode<Endian> for i16[src]

impl Encode<()> for i16[src]

impl Encode<Endian> for i32[src]

impl Encode<()> for i32[src]

impl Encode<Endian> for i64[src]

impl Encode<()> for i64[src]

impl Encode<Endian> for i128[src]

impl Encode<()> for i128[src]

impl Encode<Endian> for f32[src]

impl Encode<()> for f32[src]

impl Encode<Endian> for f64[src]

impl Encode<()> for f64[src]

Loading content...

Implementors

Loading content...