Skip to main content

JsonEncode

Trait JsonEncode 

Source
pub trait JsonEncode: Sized {
    // Required methods
    fn json_len(&self) -> usize;
    fn write_into<W: Write>(&self, w: &mut W);

    // Provided methods
    fn write_json(&self, out: &mut Vec<u8>) { ... }
    fn encode_json(&self) -> Vec<u8>  { ... }
}

Required Methods§

Source

fn json_len(&self) -> usize

Source

fn write_into<W: Write>(&self, w: &mut W)

Provided Methods§

Source

fn write_json(&self, out: &mut Vec<u8>)

Source

fn encode_json(&self) -> Vec<u8>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> JsonEncode for &T
where T: JsonEncode,

Source§

fn json_len(&self) -> usize

Source§

fn write_into<W: Write>(&self, w: &mut W)

Source§

fn write_json(&self, out: &mut Vec<u8>)

Implementors§