Struct Serializer

pub struct Serializer<W, F = CompactFormatter> { /* private fields */ }

A structure for serializing Rust values into JSON.

Implementations

impl<'a, W> Serializer<W, PrettyFormatter<'a>> where W: Write,

fn pretty(writer: W) -> Self

Creates a new JSON pretty print serializer.

impl<W> Serializer<W> where W: Write,

fn new(writer: W) -> Self

Creates a new JSON serializer.

impl<W, F> Serializer<W, F> where W: Write, F: Formatter,

fn with_formatter(writer: W, formatter: F) -> Self

Creates a new JSON visitor whose output will be written to the writer specified.

fn into_inner(self) -> W

Unwrap the Writer from the Serializer.

Auto Trait Implementations

impl<W, F> Freeze for Serializer<W, F> where W: Freeze, F: Freeze,

impl<W, F> RefUnwindSafe for Serializer<W, F> where W: RefUnwindSafe, F: RefUnwindSafe,

impl<W, F> Send for Serializer<W, F> where W: Send, F: Send,

impl<W, F> Sync for Serializer<W, F> where W: Sync, F: Sync,

impl<W, F> Unpin for Serializer<W, F> where W: Unpin, F: Unpin,

impl<W, F> UnsafeUnpin for Serializer<W, F> where W: UnsafeUnpin, F: UnsafeUnpin,

impl<W, F> UnwindSafe for Serializer<W, F> where W: UnwindSafe, F: UnwindSafe,

Blanket Implementations

impl<T> Any for Serializer<W, F> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Serializer<W, F> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Serializer<W, F> where T: ?Sized,

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

impl<T> From<T> for Serializer<W, F>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for Serializer<W, F> 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 Serializer<W, F> where U: Into<T>,

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

impl<T, U> TryInto<U> for Serializer<W, F> where U: TryFrom<T>,

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