[][src]Struct json_color::Colorizer

pub struct Colorizer {
    pub null: Color,
    pub boolean: Color,
    pub number: Color,
    pub string: Color,
    pub key: Color,
    // some fields omitted
}

A struct representing a specific configuration of colors for the various JSON components.

Fields

null: Colorboolean: Colornumber: Colorstring: Colorkey: Color

Methods

impl Colorizer[src]

pub fn new() -> ColorizerBuilder[src]

Start builder a new Colorizer.

pub fn arbitrary() -> Self[src]

Creates a new Colorizer with a predefined set of colors for the various JSON components.

Use this if you want your JSON to be colored, but don't care about the specific colors.

pub fn colorize_json_str(&self, s: &str) -> Result<String>[src]

Colorize a JSON string. Currently, all strings will be pretty-printed (with indentation and spacing).

Errors

An error is returned if the string is invalid JSON or an I/O error occurs.

pub fn colorize_to_writer<W>(&self, s: &str, writer: &mut W) -> Result<()> where
    W: Write
[src]

Colorize a JSON string and write the result to writer.

Currently, all strings will be pretty-printed (with indentation and spacing).

Errors

An error is returned if the string is invalid JSON or an I/O error occurs.

Trait Implementations

impl Default for Colorizer[src]

impl Clone for Colorizer[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Formatter for Colorizer[src]

fn write_number_str<W>(
    &mut self,
    writer: &mut W,
    value: &str
) -> Result<(), Error> where
    W: Write + ?Sized
[src]

Writes a number that has already been rendered to a string.

fn end_array_value<W>(&mut self, _writer: &mut W) -> Result<(), Error> where
    W: Write + ?Sized
[src]

Called after every array value.

fn end_object_value<W>(&mut self, _writer: &mut W) -> Result<(), Error> where
    W: Write + ?Sized
[src]

Called after every object value.

fn write_raw_fragment<W>(
    &mut self,
    writer: &mut W,
    fragment: &str
) -> Result<(), Error> where
    W: Write + ?Sized
[src]

Writes a raw JSON fragment that doesn't need any escaping to the specified writer. Read more

Auto Trait Implementations

impl Send for Colorizer

impl Sync for Colorizer

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.