CanonJsonSerialize

Trait CanonJsonSerialize 

Source
pub trait CanonJsonSerialize {
    // Required methods
    fn to_canon_json_writer<W>(&self, writer: W) -> Result<()>
       where W: Write;
    fn to_canon_json_vec(&self) -> Result<Vec<u8>>;
    fn to_canon_json_string(&self) -> Result<String>;
}
Expand description

A helper trait to write canonical JSON.

Required Methods§

Source

fn to_canon_json_writer<W>(&self, writer: W) -> Result<()>
where W: Write,

Serialize the given data structure as JSON into the I/O stream.

Source

fn to_canon_json_vec(&self) -> Result<Vec<u8>>

Serialize the given data structure as a JSON byte vector.

Source

fn to_canon_json_string(&self) -> Result<String>

Serialize the given data structure as a String.

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§

Source§

impl<S> CanonJsonSerialize for S
where S: Serialize,