JsonFormatter

Trait JsonFormatter 

Source
pub trait JsonFormatter {
    // Required methods
    fn after_key(&self) -> &str;
    fn after_start_nested(&mut self) -> &str;
    fn after_element(&self) -> &str;
    fn before_end_nested(&mut self, is_empty: bool) -> &str;
    fn indent(&self) -> &str;
}
Expand description

JsonFormatter controls how whitespace is added between JSON elements in the output. It does not affect the JSON’s semantics, but only its looks and size.

Required Methods§

Source

fn after_key(&self) -> &str

optional whitespace after the ‘:’ of a JSON object’s key.

Source

fn after_start_nested(&mut self) -> &str

optional newline after the start of an object or array; adds a level of nesting

Source

fn after_element(&self) -> &str

optional newline after an element

Source

fn before_end_nested(&mut self, is_empty: bool) -> &str

optional indent before then ending character of a nested object or array; removes a level of nesting

Source

fn indent(&self) -> &str

indentation, if any

Implementors§