Trait Encoder

Source
pub trait Encoder {
    type Error;

    // Required method
    fn encode<W>(
        &self,
        target: &mut W,
        value: &Value,
    ) -> Result<usize, Self::Error>
       where W: Write + WriteBytesExt;
}
Expand description

A schema to serialize a value to bytes.

Required Associated Types§

Source

type Error

Error encoding a value.

Required Methods§

Source

fn encode<W>(&self, target: &mut W, value: &Value) -> Result<usize, Self::Error>
where W: Write + WriteBytesExt,

Write a Json value according to the schema.

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.

Implementors§