pub trait Formatter {
// Required methods
fn open<W>(&mut self, writer: &mut W, ch: u8) -> Result<()>
where W: Write;
fn comma<W>(&mut self, writer: &mut W, first: bool) -> Result<()>
where W: Write;
fn colon<W>(&mut self, writer: &mut W) -> Result<()>
where W: Write;
fn close<W>(&mut self, writer: &mut W, ch: u8) -> Result<()>
where W: Write;
fn newline<W>(&mut self, writer: &mut W, add_indent: i32) -> Result<()>
where W: Write;
fn start_value<W>(&mut self, writer: &mut W) -> Result<()>
where W: Write;
}
Expand description
This trait abstracts away serializing the JSON control characters
Required Methods§
Sourcefn open<W>(&mut self, writer: &mut W, ch: u8) -> Result<()>where
W: Write,
fn open<W>(&mut self, writer: &mut W, ch: u8) -> Result<()>where
W: Write,
Called when serializing a ‘{’ or ‘[’.
Sourcefn comma<W>(&mut self, writer: &mut W, first: bool) -> Result<()>where
W: Write,
fn comma<W>(&mut self, writer: &mut W, first: bool) -> Result<()>where
W: Write,
Called when serializing a ‘,’.
Sourcefn colon<W>(&mut self, writer: &mut W) -> Result<()>where
W: Write,
fn colon<W>(&mut self, writer: &mut W) -> Result<()>where
W: Write,
Called when serializing a ‘:’.
Sourcefn close<W>(&mut self, writer: &mut W, ch: u8) -> Result<()>where
W: Write,
fn close<W>(&mut self, writer: &mut W, ch: u8) -> Result<()>where
W: Write,
Called when serializing a ‘}’ or ‘]’.
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.