Struct serde_json::ser::Serializer [] [src]

pub struct Serializer<W, F = CompactFormatter> {
    // some fields omitted
}

A structure for serializing Rust values into JSON.

Methods

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

fn new(writer: W) -> Self

Creates a new JSON serializer.

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

fn pretty(writer: W) -> Self

Creates a new JSON pretty print 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.

Trait Implementations

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

type Error = Error

fn visit_bool(&mut self, value: bool) -> Result<()>

fn visit_isize(&mut self, value: isize) -> Result<()>

fn visit_i8(&mut self, value: i8) -> Result<()>

fn visit_i16(&mut self, value: i16) -> Result<()>

fn visit_i32(&mut self, value: i32) -> Result<()>

fn visit_i64(&mut self, value: i64) -> Result<()>

fn visit_usize(&mut self, value: usize) -> Result<()>

fn visit_u8(&mut self, value: u8) -> Result<()>

fn visit_u16(&mut self, value: u16) -> Result<()>

fn visit_u32(&mut self, value: u32) -> Result<()>

fn visit_u64(&mut self, value: u64) -> Result<()>

fn visit_f32(&mut self, value: f32) -> Result<()>

fn visit_f64(&mut self, value: f64) -> Result<()>

fn visit_char(&mut self, value: char) -> Result<()>

fn visit_str(&mut self, value: &str) -> Result<()>

fn visit_none(&mut self) -> Result<()>

fn visit_some<V>(&mut self, value: V) -> Result<()> where V: Serialize

fn visit_unit(&mut self) -> Result<()>

fn visit_newtype_struct<T>(&mut self, _name: &'static str, value: T) -> Result<()> where T: Serialize

fn visit_unit_variant(&mut self, _name: &str, _variant_index: usize, variant: &str) -> Result<()>

fn visit_newtype_variant<T>(&mut self, _name: &str, _variant_index: usize, variant: &str, value: T) -> Result<()> where T: Serialize

fn visit_seq<V>(&mut self, visitor: V) -> Result<()> where V: SeqVisitor

fn visit_tuple_variant<V>(&mut self, _name: &str, _variant_index: usize, variant: &str, visitor: V) -> Result<()> where V: SeqVisitor

fn visit_seq_elt<T>(&mut self, value: T) -> Result<()> where T: Serialize

fn visit_map<V>(&mut self, visitor: V) -> Result<()> where V: MapVisitor

fn visit_struct_variant<V>(&mut self, _name: &str, _variant_index: usize, variant: &str, visitor: V) -> Result<()> where V: MapVisitor

fn visit_map_elt<K, V>(&mut self, key: K, value: V) -> Result<()> where K: Serialize, V: Serialize

fn format() -> &'static str

fn visit_bytes(&mut self, value: &[u8]) -> Result<(), Self::Error>

fn visit_unit_struct(&mut self, _name: &'static str) -> Result<(), Self::Error>

fn visit_tuple<V>(&mut self, visitor: V) -> Result<(), Self::Error> where V: SeqVisitor

fn visit_tuple_elt<T>(&mut self, value: T) -> Result<(), Self::Error> where T: Serialize

fn visit_tuple_struct<V>(&mut self, _name: &'static str, visitor: V) -> Result<(), Self::Error> where V: SeqVisitor

fn visit_tuple_struct_elt<T>(&mut self, value: T) -> Result<(), Self::Error> where T: Serialize

fn visit_tuple_variant_elt<T>(&mut self, value: T) -> Result<(), Self::Error> where T: Serialize

fn visit_struct<V>(&mut self, _name: &'static str, visitor: V) -> Result<(), Self::Error> where V: MapVisitor

fn visit_struct_elt<V>(&mut self, key: &'static str, value: V) -> Result<(), Self::Error> where V: Serialize

fn visit_struct_variant_elt<V>(&mut self, key: &'static str, value: V) -> Result<(), Self::Error> where V: Serialize