Struct PrettyFormatter

pub struct PrettyFormatter<'a> { /* private fields */ }

This structure pretty prints a JSON value to make it human readable.

Implementations

impl<'a> PrettyFormatter<'a>

fn new() -> Self

Construct a pretty printer formatter that defaults to using two spaces for indentation.

fn with_indent(indent: &'a [u8]) -> Self

Construct a pretty printer formatter that uses the indent string for indentation.

Trait Implementations

impl<'a> Clone for PrettyFormatter<'a>

fn clone(&self) -> PrettyFormatter<'a>

impl<'a> Debug for PrettyFormatter<'a>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<'a> Default for PrettyFormatter<'a>

fn default() -> Self

impl<'a> Formatter for PrettyFormatter<'a>

fn begin_array<W>(&mut self, writer: &mut W) -> Result<()>
where
    W: ?Sized + Write,
fn end_array<W>(&mut self, writer: &mut W) -> Result<()>
where
    W: ?Sized + Write,
fn begin_array_value<W>(&mut self, writer: &mut W, first: bool) -> Result<()>
where
    W: ?Sized + Write,
fn end_array_value<W>(&mut self, _writer: &mut W) -> Result<()>
where
    W: ?Sized + Write,
fn begin_object<W>(&mut self, writer: &mut W) -> Result<()>
where
    W: ?Sized + Write,
fn end_object<W>(&mut self, writer: &mut W) -> Result<()>
where
    W: ?Sized + Write,
fn begin_object_key<W>(&mut self, writer: &mut W, first: bool) -> Result<()>
where
    W: ?Sized + Write,
fn begin_object_value<W>(&mut self, writer: &mut W) -> Result<()>
where
    W: ?Sized + Write,
fn end_object_value<W>(&mut self, _writer: &mut W) -> Result<()>
where
    W: ?Sized + Write,

Auto Trait Implementations

impl<'a> Freeze for PrettyFormatter<'a>

impl<'a> RefUnwindSafe for PrettyFormatter<'a>

impl<'a> Send for PrettyFormatter<'a>

impl<'a> Sync for PrettyFormatter<'a>

impl<'a> Unpin for PrettyFormatter<'a>

impl<'a> UnsafeUnpin for PrettyFormatter<'a>

impl<'a> UnwindSafe for PrettyFormatter<'a>

Blanket Implementations

impl<T> Any for PrettyFormatter<'a> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for PrettyFormatter<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for PrettyFormatter<'a> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for PrettyFormatter<'a> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for PrettyFormatter<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for PrettyFormatter<'a> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for PrettyFormatter<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for PrettyFormatter<'a> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for PrettyFormatter<'a> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>