Trait burn::serde::ser::Serializer

source ·
pub trait Serializer: Sized {
    type Ok;
    type Error: Error;
    type SerializeSeq: SerializeSeq<Ok = Self::Ok, Error = Self::Error>;
    type SerializeTuple: SerializeTuple<Ok = Self::Ok, Error = Self::Error>;
    type SerializeTupleStruct: SerializeTupleStruct<Ok = Self::Ok, Error = Self::Error>;
    type SerializeTupleVariant: SerializeTupleVariant<Ok = Self::Ok, Error = Self::Error>;
    type SerializeMap: SerializeMap<Ok = Self::Ok, Error = Self::Error>;
    type SerializeStruct: SerializeStruct<Ok = Self::Ok, Error = Self::Error>;
    type SerializeStructVariant: SerializeStructVariant<Ok = Self::Ok, Error = Self::Error>;

Show 34 methods // Required methods fn serialize_bool(self, v: bool) -> Result<Self::Ok, Self::Error>; fn serialize_i8(self, v: i8) -> Result<Self::Ok, Self::Error>; fn serialize_i16(self, v: i16) -> Result<Self::Ok, Self::Error>; fn serialize_i32(self, v: i32) -> Result<Self::Ok, Self::Error>; fn serialize_i64(self, v: i64) -> Result<Self::Ok, Self::Error>; fn serialize_u8(self, v: u8) -> Result<Self::Ok, Self::Error>; fn serialize_u16(self, v: u16) -> Result<Self::Ok, Self::Error>; fn serialize_u32(self, v: u32) -> Result<Self::Ok, Self::Error>; fn serialize_u64(self, v: u64) -> Result<Self::Ok, Self::Error>; fn serialize_f32(self, v: f32) -> Result<Self::Ok, Self::Error>; fn serialize_f64(self, v: f64) -> Result<Self::Ok, Self::Error>; fn serialize_char(self, v: char) -> Result<Self::Ok, Self::Error>; fn serialize_str(self, v: &str) -> Result<Self::Ok, Self::Error>; fn serialize_bytes(self, v: &[u8]) -> Result<Self::Ok, Self::Error>; fn serialize_none(self) -> Result<Self::Ok, Self::Error>; fn serialize_some<T>(self, value: &T) -> Result<Self::Ok, Self::Error> where T: Serialize + ?Sized; fn serialize_unit(self) -> Result<Self::Ok, Self::Error>; fn serialize_unit_struct( self, name: &'static str, ) -> Result<Self::Ok, Self::Error>; fn serialize_unit_variant( self, name: &'static str, variant_index: u32, variant: &'static str, ) -> Result<Self::Ok, Self::Error>; fn serialize_newtype_struct<T>( self, name: &'static str, value: &T, ) -> Result<Self::Ok, Self::Error> where T: Serialize + ?Sized; fn serialize_newtype_variant<T>( self, name: &'static str, variant_index: u32, variant: &'static str, value: &T, ) -> Result<Self::Ok, Self::Error> where T: Serialize + ?Sized; fn serialize_seq( self, len: Option<usize>, ) -> Result<Self::SerializeSeq, Self::Error>; fn serialize_tuple( self, len: usize, ) -> Result<Self::SerializeTuple, Self::Error>; fn serialize_tuple_struct( self, name: &'static str, len: usize, ) -> Result<Self::SerializeTupleStruct, Self::Error>; fn serialize_tuple_variant( self, name: &'static str, variant_index: u32, variant: &'static str, len: usize, ) -> Result<Self::SerializeTupleVariant, Self::Error>; fn serialize_map( self, len: Option<usize>, ) -> Result<Self::SerializeMap, Self::Error>; fn serialize_struct( self, name: &'static str, len: usize, ) -> Result<Self::SerializeStruct, Self::Error>; fn serialize_struct_variant( self, name: &'static str, variant_index: u32, variant: &'static str, len: usize, ) -> Result<Self::SerializeStructVariant, Self::Error>; // Provided methods fn serialize_i128(self, v: i128) -> Result<Self::Ok, Self::Error> { ... } fn serialize_u128(self, v: u128) -> Result<Self::Ok, Self::Error> { ... } fn collect_seq<I>(self, iter: I) -> Result<Self::Ok, Self::Error> where I: IntoIterator, <I as IntoIterator>::Item: Serialize { ... } fn collect_map<K, V, I>(self, iter: I) -> Result<Self::Ok, Self::Error> where K: Serialize, V: Serialize, I: IntoIterator<Item = (K, V)> { ... } fn collect_str<T>(self, value: &T) -> Result<Self::Ok, Self::Error> where T: Display + ?Sized { ... } fn is_human_readable(&self) -> bool { ... }
}
Expand description

A data format that can serialize any data structure supported by Serde.

The role of this trait is to define the serialization half of the Serde data model, which is a way to categorize every Rust data structure into one of 29 possible types. Each method of the Serializer trait corresponds to one of the types of the data model.

Implementations of Serialize map themselves into this data model by invoking exactly one of the Serializer methods.

The types that make up the Serde data model are:

  • 14 primitive types
    • bool
    • i8, i16, i32, i64, i128
    • u8, u16, u32, u64, u128
    • f32, f64
    • char
  • string
    • UTF-8 bytes with a length and no null terminator.
    • When serializing, all strings are handled equally. When deserializing, there are three flavors of strings: transient, owned, and borrowed.
  • byte array - [u8]
    • Similar to strings, during deserialization byte arrays can be transient, owned, or borrowed.
  • option
    • Either none or some value.
  • unit
    • The type of () in Rust. It represents an anonymous value containing no data.
  • unit_struct
    • For example struct Unit or PhantomData<T>. It represents a named value containing no data.
  • unit_variant
    • For example the E::A and E::B in enum E { A, B }.
  • newtype_struct
    • For example struct Millimeters(u8).
  • newtype_variant
    • For example the E::N in enum E { N(u8) }.
  • seq
    • A variably sized heterogeneous sequence of values, for example Vec<T> or HashSet<T>. When serializing, the length may or may not be known before iterating through all the data. When deserializing, the length is determined by looking at the serialized data.
  • tuple
    • A statically sized heterogeneous sequence of values for which the length will be known at deserialization time without looking at the serialized data, for example (u8,) or (String, u64, Vec<T>) or [u64; 10].
  • tuple_struct
    • A named tuple, for example struct Rgb(u8, u8, u8).
  • tuple_variant
    • For example the E::T in enum E { T(u8, u8) }.
  • map
    • A heterogeneous key-value pairing, for example BTreeMap<K, V>.
  • struct
    • A heterogeneous key-value pairing in which the keys are strings and will be known at deserialization time without looking at the serialized data, for example struct S { r: u8, g: u8, b: u8 }.
  • struct_variant
    • For example the E::S in enum E { S { r: u8, g: u8, b: u8 } }.

Many Serde serializers produce text or binary data as output, for example JSON or Postcard. This is not a requirement of the Serializer trait, and there are serializers that do not produce text or binary output. One example is the serde_json::value::Serializer (distinct from the main serde_json serializer) that produces a serde_json::Value data structure in memory as output.

§Example implementation

The example data format presented on the website contains example code for a basic JSON Serializer.

Required Associated Types§

source

type Ok

The output type produced by this Serializer during successful serialization. Most serializers that produce text or binary output should set Ok = () and serialize into an io::Write or buffer contained within the Serializer instance. Serializers that build in-memory data structures may be simplified by using Ok to propagate the data structure around.

source

type Error: Error

The error type when some error occurs during serialization.

source

type SerializeSeq: SerializeSeq<Ok = Self::Ok, Error = Self::Error>

Type returned from serialize_seq for serializing the content of the sequence.

source

type SerializeTuple: SerializeTuple<Ok = Self::Ok, Error = Self::Error>

Type returned from serialize_tuple for serializing the content of the tuple.

source

type SerializeTupleStruct: SerializeTupleStruct<Ok = Self::Ok, Error = Self::Error>

Type returned from serialize_tuple_struct for serializing the content of the tuple struct.

source

type SerializeTupleVariant: SerializeTupleVariant<Ok = Self::Ok, Error = Self::Error>

Type returned from serialize_tuple_variant for serializing the content of the tuple variant.

source

type SerializeMap: SerializeMap<Ok = Self::Ok, Error = Self::Error>

Type returned from serialize_map for serializing the content of the map.

source

type SerializeStruct: SerializeStruct<Ok = Self::Ok, Error = Self::Error>

Type returned from serialize_struct for serializing the content of the struct.

source

type SerializeStructVariant: SerializeStructVariant<Ok = Self::Ok, Error = Self::Error>

Type returned from serialize_struct_variant for serializing the content of the struct variant.

Required Methods§

source

fn serialize_bool(self, v: bool) -> Result<Self::Ok, Self::Error>

Serialize a bool value.

impl Serialize for bool {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_bool(*self)
    }
}
source

fn serialize_i8(self, v: i8) -> Result<Self::Ok, Self::Error>

Serialize an i8 value.

If the format does not differentiate between i8 and i64, a reasonable implementation would be to cast the value to i64 and forward to serialize_i64.

impl Serialize for i8 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_i8(*self)
    }
}
source

fn serialize_i16(self, v: i16) -> Result<Self::Ok, Self::Error>

Serialize an i16 value.

If the format does not differentiate between i16 and i64, a reasonable implementation would be to cast the value to i64 and forward to serialize_i64.

impl Serialize for i16 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_i16(*self)
    }
}
source

fn serialize_i32(self, v: i32) -> Result<Self::Ok, Self::Error>

Serialize an i32 value.

If the format does not differentiate between i32 and i64, a reasonable implementation would be to cast the value to i64 and forward to serialize_i64.

impl Serialize for i32 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_i32(*self)
    }
}
source

fn serialize_i64(self, v: i64) -> Result<Self::Ok, Self::Error>

Serialize an i64 value.

impl Serialize for i64 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_i64(*self)
    }
}
source

fn serialize_u8(self, v: u8) -> Result<Self::Ok, Self::Error>

Serialize a u8 value.

If the format does not differentiate between u8 and u64, a reasonable implementation would be to cast the value to u64 and forward to serialize_u64.

impl Serialize for u8 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_u8(*self)
    }
}
source

fn serialize_u16(self, v: u16) -> Result<Self::Ok, Self::Error>

Serialize a u16 value.

If the format does not differentiate between u16 and u64, a reasonable implementation would be to cast the value to u64 and forward to serialize_u64.

impl Serialize for u16 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_u16(*self)
    }
}
source

fn serialize_u32(self, v: u32) -> Result<Self::Ok, Self::Error>

Serialize a u32 value.

If the format does not differentiate between u32 and u64, a reasonable implementation would be to cast the value to u64 and forward to serialize_u64.

impl Serialize for u32 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_u32(*self)
    }
}
source

fn serialize_u64(self, v: u64) -> Result<Self::Ok, Self::Error>

Serialize a u64 value.

impl Serialize for u64 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_u64(*self)
    }
}
source

fn serialize_f32(self, v: f32) -> Result<Self::Ok, Self::Error>

Serialize an f32 value.

If the format does not differentiate between f32 and f64, a reasonable implementation would be to cast the value to f64 and forward to serialize_f64.

impl Serialize for f32 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_f32(*self)
    }
}
source

fn serialize_f64(self, v: f64) -> Result<Self::Ok, Self::Error>

Serialize an f64 value.

impl Serialize for f64 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_f64(*self)
    }
}
source

fn serialize_char(self, v: char) -> Result<Self::Ok, Self::Error>

Serialize a character.

If the format does not support characters, it is reasonable to serialize it as a single element str or a u32.

impl Serialize for char {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_char(*self)
    }
}
source

fn serialize_str(self, v: &str) -> Result<Self::Ok, Self::Error>

Serialize a &str.

impl Serialize for str {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_str(self)
    }
}
source

fn serialize_bytes(self, v: &[u8]) -> Result<Self::Ok, Self::Error>

Serialize a chunk of raw byte data.

Enables serializers to serialize byte slices more compactly or more efficiently than other types of slices. If no efficient implementation is available, a reasonable implementation would be to forward to serialize_seq. If forwarded, the implementation looks usually just like this:

fn serialize_bytes(self, v: &[u8]) -> Result<Self::Ok, Self::Error> {
    let mut seq = self.serialize_seq(Some(v.len()))?;
    for b in v {
        seq.serialize_element(b)?;
    }
    seq.end()
}
source

fn serialize_none(self) -> Result<Self::Ok, Self::Error>

Serialize a None value.

impl<T> Serialize for Option<T>
where
    T: Serialize,
{
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match *self {
            Some(ref value) => serializer.serialize_some(value),
            None => serializer.serialize_none(),
        }
    }
}
source

fn serialize_some<T>(self, value: &T) -> Result<Self::Ok, Self::Error>
where T: Serialize + ?Sized,

Serialize a Some(T) value.

impl<T> Serialize for Option<T>
where
    T: Serialize,
{
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match *self {
            Some(ref value) => serializer.serialize_some(value),
            None => serializer.serialize_none(),
        }
    }
}
source

fn serialize_unit(self) -> Result<Self::Ok, Self::Error>

Serialize a () value.

impl Serialize for () {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_unit()
    }
}
source

fn serialize_unit_struct( self, name: &'static str, ) -> Result<Self::Ok, Self::Error>

Serialize a unit struct like struct Unit or PhantomData<T>.

A reasonable implementation would be to forward to serialize_unit.

use serde::{Serialize, Serializer};

struct Nothing;

impl Serialize for Nothing {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_unit_struct("Nothing")
    }
}
source

fn serialize_unit_variant( self, name: &'static str, variant_index: u32, variant: &'static str, ) -> Result<Self::Ok, Self::Error>

Serialize a unit variant like E::A in enum E { A, B }.

The name is the name of the enum, the variant_index is the index of this variant within the enum, and the variant is the name of the variant.

use serde::{Serialize, Serializer};

enum E {
    A,
    B,
}

impl Serialize for E {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match *self {
            E::A => serializer.serialize_unit_variant("E", 0, "A"),
            E::B => serializer.serialize_unit_variant("E", 1, "B"),
        }
    }
}
source

fn serialize_newtype_struct<T>( self, name: &'static str, value: &T, ) -> Result<Self::Ok, Self::Error>
where T: Serialize + ?Sized,

Serialize a newtype struct like struct Millimeters(u8).

Serializers are encouraged to treat newtype structs as insignificant wrappers around the data they contain. A reasonable implementation would be to forward to value.serialize(self).

use serde::{Serialize, Serializer};

struct Millimeters(u8);

impl Serialize for Millimeters {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_newtype_struct("Millimeters", &self.0)
    }
}
source

fn serialize_newtype_variant<T>( self, name: &'static str, variant_index: u32, variant: &'static str, value: &T, ) -> Result<Self::Ok, Self::Error>
where T: Serialize + ?Sized,

Serialize a newtype variant like E::N in enum E { N(u8) }.

The name is the name of the enum, the variant_index is the index of this variant within the enum, and the variant is the name of the variant. The value is the data contained within this newtype variant.

use serde::{Serialize, Serializer};

enum E {
    M(String),
    N(u8),
}

impl Serialize for E {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match *self {
            E::M(ref s) => serializer.serialize_newtype_variant("E", 0, "M", s),
            E::N(n) => serializer.serialize_newtype_variant("E", 1, "N", &n),
        }
    }
}
source

fn serialize_seq( self, len: Option<usize>, ) -> Result<Self::SerializeSeq, Self::Error>

Begin to serialize a variably sized sequence. This call must be followed by zero or more calls to serialize_element, then a call to end.

The argument is the number of elements in the sequence, which may or may not be computable before the sequence is iterated. Some serializers only support sequences whose length is known up front.

use serde::ser::{Serialize, SerializeSeq, Serializer};

impl<T> Serialize for Vec<T>
where
    T: Serialize,
{
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let mut seq = serializer.serialize_seq(Some(self.len()))?;
        for element in self {
            seq.serialize_element(element)?;
        }
        seq.end()
    }
}
source

fn serialize_tuple( self, len: usize, ) -> Result<Self::SerializeTuple, Self::Error>

Begin to serialize a statically sized sequence whose length will be known at deserialization time without looking at the serialized data. This call must be followed by zero or more calls to serialize_element, then a call to end.

use serde::ser::{Serialize, SerializeTuple, Serializer};

impl<A, B, C> Serialize for (A, B, C)
where
    A: Serialize,
    B: Serialize,
    C: Serialize,
{
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let mut tup = serializer.serialize_tuple(3)?;
        tup.serialize_element(&self.0)?;
        tup.serialize_element(&self.1)?;
        tup.serialize_element(&self.2)?;
        tup.end()
    }
}
use serde::ser::{Serialize, SerializeTuple, Serializer};

const VRAM_SIZE: usize = 386;
struct Vram([u16; VRAM_SIZE]);

impl Serialize for Vram {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let mut seq = serializer.serialize_tuple(VRAM_SIZE)?;
        for element in &self.0[..] {
            seq.serialize_element(element)?;
        }
        seq.end()
    }
}
source

fn serialize_tuple_struct( self, name: &'static str, len: usize, ) -> Result<Self::SerializeTupleStruct, Self::Error>

Begin to serialize a tuple struct like struct Rgb(u8, u8, u8). This call must be followed by zero or more calls to serialize_field, then a call to end.

The name is the name of the tuple struct and the len is the number of data fields that will be serialized.

use serde::ser::{Serialize, SerializeTupleStruct, Serializer};

struct Rgb(u8, u8, u8);

impl Serialize for Rgb {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let mut ts = serializer.serialize_tuple_struct("Rgb", 3)?;
        ts.serialize_field(&self.0)?;
        ts.serialize_field(&self.1)?;
        ts.serialize_field(&self.2)?;
        ts.end()
    }
}
source

fn serialize_tuple_variant( self, name: &'static str, variant_index: u32, variant: &'static str, len: usize, ) -> Result<Self::SerializeTupleVariant, Self::Error>

Begin to serialize a tuple variant like E::T in enum E { T(u8, u8) }. This call must be followed by zero or more calls to serialize_field, then a call to end.

The name is the name of the enum, the variant_index is the index of this variant within the enum, the variant is the name of the variant, and the len is the number of data fields that will be serialized.

use serde::ser::{Serialize, SerializeTupleVariant, Serializer};

enum E {
    T(u8, u8),
    U(String, u32, u32),
}

impl Serialize for E {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match *self {
            E::T(ref a, ref b) => {
                let mut tv = serializer.serialize_tuple_variant("E", 0, "T", 2)?;
                tv.serialize_field(a)?;
                tv.serialize_field(b)?;
                tv.end()
            }
            E::U(ref a, ref b, ref c) => {
                let mut tv = serializer.serialize_tuple_variant("E", 1, "U", 3)?;
                tv.serialize_field(a)?;
                tv.serialize_field(b)?;
                tv.serialize_field(c)?;
                tv.end()
            }
        }
    }
}
source

fn serialize_map( self, len: Option<usize>, ) -> Result<Self::SerializeMap, Self::Error>

Begin to serialize a map. This call must be followed by zero or more calls to serialize_key and serialize_value, then a call to end.

The argument is the number of elements in the map, which may or may not be computable before the map is iterated. Some serializers only support maps whose length is known up front.

use serde::ser::{Serialize, SerializeMap, Serializer};

impl<K, V> Serialize for HashMap<K, V>
where
    K: Serialize,
    V: Serialize,
{
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let mut map = serializer.serialize_map(Some(self.len()))?;
        for (k, v) in self {
            map.serialize_entry(k, v)?;
        }
        map.end()
    }
}
source

fn serialize_struct( self, name: &'static str, len: usize, ) -> Result<Self::SerializeStruct, Self::Error>

Begin to serialize a struct like struct Rgb { r: u8, g: u8, b: u8 }. This call must be followed by zero or more calls to serialize_field, then a call to end.

The name is the name of the struct and the len is the number of data fields that will be serialized. len does not include fields which are skipped with SerializeStruct::skip_field.

use serde::ser::{Serialize, SerializeStruct, Serializer};

struct Rgb {
    r: u8,
    g: u8,
    b: u8,
}

impl Serialize for Rgb {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        let mut rgb = serializer.serialize_struct("Rgb", 3)?;
        rgb.serialize_field("r", &self.r)?;
        rgb.serialize_field("g", &self.g)?;
        rgb.serialize_field("b", &self.b)?;
        rgb.end()
    }
}
source

fn serialize_struct_variant( self, name: &'static str, variant_index: u32, variant: &'static str, len: usize, ) -> Result<Self::SerializeStructVariant, Self::Error>

Begin to serialize a struct variant like E::S in enum E { S { r: u8, g: u8, b: u8 } }. This call must be followed by zero or more calls to serialize_field, then a call to end.

The name is the name of the enum, the variant_index is the index of this variant within the enum, the variant is the name of the variant, and the len is the number of data fields that will be serialized. len does not include fields which are skipped with SerializeStructVariant::skip_field.

use serde::ser::{Serialize, SerializeStructVariant, Serializer};

enum E {
    S { r: u8, g: u8, b: u8 },
}

impl Serialize for E {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match *self {
            E::S {
                ref r,
                ref g,
                ref b,
            } => {
                let mut sv = serializer.serialize_struct_variant("E", 0, "S", 3)?;
                sv.serialize_field("r", r)?;
                sv.serialize_field("g", g)?;
                sv.serialize_field("b", b)?;
                sv.end()
            }
        }
    }
}

Provided Methods§

source

fn serialize_i128(self, v: i128) -> Result<Self::Ok, Self::Error>

Serialize an i128 value.

impl Serialize for i128 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_i128(*self)
    }
}

The default behavior unconditionally returns an error.

source

fn serialize_u128(self, v: u128) -> Result<Self::Ok, Self::Error>

Serialize a u128 value.

impl Serialize for u128 {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.serialize_u128(*self)
    }
}

The default behavior unconditionally returns an error.

source

fn collect_seq<I>(self, iter: I) -> Result<Self::Ok, Self::Error>

Collect an iterator as a sequence.

The default implementation serializes each item yielded by the iterator using serialize_seq. Implementors should not need to override this method.

use serde::{Serialize, Serializer};

struct SecretlyOneHigher {
    data: Vec<i32>,
}

impl Serialize for SecretlyOneHigher {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.collect_seq(self.data.iter().map(|x| x + 1))
    }
}
source

fn collect_map<K, V, I>(self, iter: I) -> Result<Self::Ok, Self::Error>
where K: Serialize, V: Serialize, I: IntoIterator<Item = (K, V)>,

Collect an iterator as a map.

The default implementation serializes each pair yielded by the iterator using serialize_map. Implementors should not need to override this method.

use serde::{Serialize, Serializer};
use std::collections::BTreeSet;

struct MapToUnit {
    keys: BTreeSet<i32>,
}

// Serializes as a map in which the values are all unit.
impl Serialize for MapToUnit {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.collect_map(self.keys.iter().map(|k| (k, ())))
    }
}
source

fn collect_str<T>(self, value: &T) -> Result<Self::Ok, Self::Error>
where T: Display + ?Sized,

Serialize a string produced by an implementation of Display.

The default implementation builds a heap-allocated String and delegates to serialize_str. Serializers are encouraged to provide a more efficient implementation if possible.

use serde::{Serialize, Serializer};

impl Serialize for DateTime {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        serializer.collect_str(&format_args!("{:?}{:?}", self.naive_local(), self.offset()))
    }
}
source

fn is_human_readable(&self) -> bool

Determine whether Serialize implementations should serialize in human-readable form.

Some types have a human-readable form that may be somewhat expensive to construct, as well as a binary form that is compact and efficient. Generally text-based formats like JSON and YAML will prefer to use the human-readable one and binary formats like Postcard will prefer the compact one.

use serde::{Serialize, Serializer};

impl Serialize for Timestamp {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        if serializer.is_human_readable() {
            // Serialize to a human-readable string "2015-05-15T17:01:00Z".
            self.to_string().serialize(serializer)
        } else {
            // Serialize to a compact binary representation.
            self.seconds_since_epoch().serialize(serializer)
        }
    }
}

The default implementation of this method returns true. Data formats may override this to false to request a compact form for types that support one. Note that modifying this method to change a format from human-readable to compact or vice versa should be regarded as a breaking change, as a value serialized in human-readable mode is not required to deserialize from the same data in compact mode.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Serializer for Serializer

source§

type Ok = Value

source§

type Error = Error

source§

type SerializeSeq = SerializeVec

source§

type SerializeTuple = SerializeVec

source§

type SerializeTupleStruct = SerializeVec

source§

type SerializeTupleVariant = SerializeTupleVariant

source§

type SerializeMap = SerializeMap

source§

type SerializeStruct = SerializeMap

source§

type SerializeStructVariant = SerializeStructVariant

source§

fn serialize_bool(self, value: bool) -> Result<Value, Error>

source§

fn serialize_i8(self, value: i8) -> Result<Value, Error>

source§

fn serialize_i16(self, value: i16) -> Result<Value, Error>

source§

fn serialize_i32(self, value: i32) -> Result<Value, Error>

source§

fn serialize_i64(self, value: i64) -> Result<Value, Error>

source§

fn serialize_i128(self, value: i128) -> Result<Value, Error>

source§

fn serialize_u8(self, value: u8) -> Result<Value, Error>

source§

fn serialize_u16(self, value: u16) -> Result<Value, Error>

source§

fn serialize_u32(self, value: u32) -> Result<Value, Error>

source§

fn serialize_u64(self, value: u64) -> Result<Value, Error>

source§

fn serialize_u128(self, value: u128) -> Result<Value, Error>

source§

fn serialize_f32(self, float: f32) -> Result<Value, Error>

source§

fn serialize_f64(self, float: f64) -> Result<Value, Error>

source§

fn serialize_char(self, value: char) -> Result<Value, Error>

source§

fn serialize_str(self, value: &str) -> Result<Value, Error>

source§

fn serialize_bytes(self, value: &[u8]) -> Result<Value, Error>

source§

fn serialize_unit(self) -> Result<Value, Error>

source§

fn serialize_unit_struct(self, _name: &'static str) -> Result<Value, Error>

source§

fn serialize_unit_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, ) -> Result<Value, Error>

source§

fn serialize_newtype_struct<T>( self, _name: &'static str, value: &T, ) -> Result<Value, Error>
where T: Serialize + ?Sized,

source§

fn serialize_newtype_variant<T>( self, _name: &'static str, _variant_index: u32, variant: &'static str, value: &T, ) -> Result<Value, Error>
where T: Serialize + ?Sized,

source§

fn serialize_none(self) -> Result<Value, Error>

source§

fn serialize_some<T>(self, value: &T) -> Result<Value, Error>
where T: Serialize + ?Sized,

source§

fn serialize_seq( self, len: Option<usize>, ) -> Result<<Serializer as Serializer>::SerializeSeq, Error>

source§

fn serialize_tuple( self, len: usize, ) -> Result<<Serializer as Serializer>::SerializeTuple, Error>

source§

fn serialize_tuple_struct( self, _name: &'static str, len: usize, ) -> Result<<Serializer as Serializer>::SerializeTupleStruct, Error>

source§

fn serialize_tuple_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, len: usize, ) -> Result<<Serializer as Serializer>::SerializeTupleVariant, Error>

source§

fn serialize_map( self, _len: Option<usize>, ) -> Result<<Serializer as Serializer>::SerializeMap, Error>

source§

fn serialize_struct( self, name: &'static str, len: usize, ) -> Result<<Serializer as Serializer>::SerializeStruct, Error>

source§

fn serialize_struct_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, _len: usize, ) -> Result<<Serializer as Serializer>::SerializeStructVariant, Error>

source§

fn collect_str<T>(self, value: &T) -> Result<Value, Error>
where T: Display + ?Sized,

§

impl Serializer for NamedSliceSerializer<'_>

§

type Ok = NamedParamSlice

§

type Error = Error

§

type SerializeSeq = Impossible<<NamedSliceSerializer<'_> as Serializer>::Ok, <NamedSliceSerializer<'_> as Serializer>::Error>

§

type SerializeTuple = Impossible<<NamedSliceSerializer<'_> as Serializer>::Ok, <NamedSliceSerializer<'_> as Serializer>::Error>

§

type SerializeTupleStruct = Impossible<<NamedSliceSerializer<'_> as Serializer>::Ok, <NamedSliceSerializer<'_> as Serializer>::Error>

§

type SerializeTupleVariant = Impossible<<NamedSliceSerializer<'_> as Serializer>::Ok, <NamedSliceSerializer<'_> as Serializer>::Error>

§

type SerializeMap = NamedSliceSerializer<'_>

§

type SerializeStruct = NamedSliceSerializer<'_>

§

type SerializeStructVariant = NamedSliceSerializer<'_>

§

fn serialize_none( self, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_some<T>( self, value: &T, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

§

fn serialize_unit( self, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_unit_struct( self, _name: &'static str, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_unit_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_newtype_struct<T>( self, _name: &'static str, value: &T, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

§

fn serialize_newtype_variant<T>( self, _name: &'static str, _variant_index: u32, _variant: &'static str, value: &T, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

§

fn serialize_bool( self, _v: bool, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_i8( self, _v: i8, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_i16( self, _v: i16, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_i32( self, _v: i32, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_i64( self, _v: i64, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_u8( self, _v: u8, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_u16( self, _v: u16, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_u32( self, _v: u32, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_u64( self, _v: u64, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_f32( self, _v: f32, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_f64( self, _v: f64, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_str( self, _v: &str, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_char( self, _v: char, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_bytes( self, _v: &[u8], ) -> Result<<NamedSliceSerializer<'_> as Serializer>::Ok, Error>

§

fn serialize_seq( self, _len: Option<usize>, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::SerializeSeq, Error>

§

fn serialize_tuple( self, _len: usize, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::SerializeTuple, Error>

§

fn serialize_tuple_struct( self, _name: &'static str, _len: usize, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::SerializeTupleStruct, Error>

§

fn serialize_tuple_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _len: usize, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::SerializeTupleVariant, Error>

§

fn serialize_map( self, len: Option<usize>, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::SerializeMap, Error>

§

fn serialize_struct( self, _name: &'static str, len: usize, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::SerializeStruct, Error>

§

fn serialize_struct_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, len: usize, ) -> Result<<NamedSliceSerializer<'_> as Serializer>::SerializeStructVariant, Error>

§

impl Serializer for PositionalSliceSerializer

§

type Ok = Vec<Box<dyn ToSql>>

§

type Error = Error

§

type SerializeSeq = PositionalSliceSerializer

§

type SerializeTuple = PositionalSliceSerializer

§

type SerializeTupleStruct = PositionalSliceSerializer

§

type SerializeTupleVariant = PositionalSliceSerializer

§

type SerializeMap = Impossible<<PositionalSliceSerializer as Serializer>::Ok, <PositionalSliceSerializer as Serializer>::Error>

§

type SerializeStruct = Impossible<<PositionalSliceSerializer as Serializer>::Ok, <PositionalSliceSerializer as Serializer>::Error>

§

type SerializeStructVariant = Impossible<<PositionalSliceSerializer as Serializer>::Ok, <PositionalSliceSerializer as Serializer>::Error>

§

fn serialize_bool( self, v: bool, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_i8( self, v: i8, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_i16( self, v: i16, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_i32( self, v: i32, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_i64( self, v: i64, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_u8( self, v: u8, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_u16( self, v: u16, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_u32( self, v: u32, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_u64( self, v: u64, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_f32( self, v: f32, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_f64( self, v: f64, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_str( self, v: &str, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_char( self, v: char, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_bytes( self, v: &[u8], ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_none( self, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_unit( self, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_some<T>( self, value: &T, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

§

fn serialize_unit_struct( self, name: &'static str, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_unit_variant( self, name: &'static str, variant_index: u32, variant: &'static str, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>

§

fn serialize_newtype_struct<T>( self, _name: &'static str, value: &T, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

§

fn serialize_newtype_variant<T>( self, _name: &'static str, _variant_index: u32, _variant: &'static str, value: &T, ) -> Result<<PositionalSliceSerializer as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

§

fn serialize_seq( self, len: Option<usize>, ) -> Result<<PositionalSliceSerializer as Serializer>::SerializeSeq, Error>

§

fn serialize_tuple( self, len: usize, ) -> Result<<PositionalSliceSerializer as Serializer>::SerializeTuple, Error>

§

fn serialize_tuple_struct( self, _name: &'static str, len: usize, ) -> Result<<PositionalSliceSerializer as Serializer>::SerializeTupleStruct, Error>

§

fn serialize_tuple_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, len: usize, ) -> Result<<PositionalSliceSerializer as Serializer>::SerializeTupleVariant, Error>

§

fn serialize_map( self, _len: Option<usize>, ) -> Result<<PositionalSliceSerializer as Serializer>::SerializeMap, Error>

§

fn serialize_struct( self, _name: &'static str, _len: usize, ) -> Result<<PositionalSliceSerializer as Serializer>::SerializeStruct, Error>

§

fn serialize_struct_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _len: usize, ) -> Result<<PositionalSliceSerializer as Serializer>::SerializeStructVariant, Error>

source§

impl<'a> Serializer for &mut Formatter<'a>

use serde::ser::Serialize;
use serde_derive::Serialize;
use std::fmt::{self, Display};

#[derive(Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum MessageType {
    StartRequest,
    EndRequest,
}

impl Display for MessageType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        self.serialize(f)
    }
}
source§

type Ok = ()

source§

type Error = Error

source§

type SerializeSeq = Impossible<(), Error>

source§

type SerializeTuple = Impossible<(), Error>

source§

type SerializeTupleStruct = Impossible<(), Error>

source§

type SerializeTupleVariant = Impossible<(), Error>

source§

type SerializeMap = Impossible<(), Error>

source§

type SerializeStruct = Impossible<(), Error>

source§

type SerializeStructVariant = Impossible<(), Error>

source§

fn serialize_bool(self, v: bool) -> Result<(), Error>

source§

fn serialize_i8(self, v: i8) -> Result<(), Error>

source§

fn serialize_i16(self, v: i16) -> Result<(), Error>

source§

fn serialize_i32(self, v: i32) -> Result<(), Error>

source§

fn serialize_i64(self, v: i64) -> Result<(), Error>

source§

fn serialize_i128(self, v: i128) -> Result<(), Error>

source§

fn serialize_u8(self, v: u8) -> Result<(), Error>

source§

fn serialize_u16(self, v: u16) -> Result<(), Error>

source§

fn serialize_u32(self, v: u32) -> Result<(), Error>

source§

fn serialize_u64(self, v: u64) -> Result<(), Error>

source§

fn serialize_u128(self, v: u128) -> Result<(), Error>

source§

fn serialize_f32(self, v: f32) -> Result<(), Error>

source§

fn serialize_f64(self, v: f64) -> Result<(), Error>

source§

fn serialize_char(self, v: char) -> Result<(), Error>

source§

fn serialize_str(self, v: &str) -> Result<(), Error>

source§

fn serialize_unit_struct(self, v: &'static str) -> Result<(), Error>

source§

fn serialize_unit_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, ) -> Result<(), Error>

source§

fn serialize_newtype_struct<T>( self, _name: &'static str, value: &T, ) -> Result<(), Error>
where T: Serialize + ?Sized,

source§

fn serialize_bytes(self, _v: &[u8]) -> Result<(), Error>

source§

fn serialize_none(self) -> Result<(), Error>

source§

fn serialize_some<T>(self, _value: &T) -> Result<(), Error>
where T: Serialize + ?Sized,

source§

fn serialize_unit(self) -> Result<(), Error>

source§

fn serialize_newtype_variant<T>( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _value: &T, ) -> Result<(), Error>
where T: Serialize + ?Sized,

source§

fn serialize_seq( self, _len: Option<usize>, ) -> Result<<&mut Formatter<'a> as Serializer>::SerializeSeq, Error>

source§

fn serialize_tuple( self, _len: usize, ) -> Result<<&mut Formatter<'a> as Serializer>::SerializeTuple, Error>

source§

fn serialize_tuple_struct( self, _name: &'static str, _len: usize, ) -> Result<<&mut Formatter<'a> as Serializer>::SerializeTupleStruct, Error>

source§

fn serialize_tuple_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _len: usize, ) -> Result<<&mut Formatter<'a> as Serializer>::SerializeTupleVariant, Error>

source§

fn serialize_map( self, _len: Option<usize>, ) -> Result<<&mut Formatter<'a> as Serializer>::SerializeMap, Error>

source§

fn serialize_struct( self, _name: &'static str, _len: usize, ) -> Result<<&mut Formatter<'a> as Serializer>::SerializeStruct, Error>

source§

fn serialize_struct_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _len: usize, ) -> Result<<&mut Formatter<'a> as Serializer>::SerializeStructVariant, Error>

source§

fn collect_str<T>(self, value: &T) -> Result<(), Error>
where T: Display + ?Sized,

§

impl<'a, W> Serializer for &mut ExtFieldSerializer<'a, W>
where W: Write + 'a,

§

type Ok = ()

§

type Error = Error

§

type SerializeSeq = Impossible<(), Error>

§

type SerializeTuple = Impossible<(), Error>

§

type SerializeTupleStruct = Impossible<(), Error>

§

type SerializeTupleVariant = Impossible<(), Error>

§

type SerializeMap = Impossible<(), Error>

§

type SerializeStruct = Impossible<(), Error>

§

type SerializeStructVariant = Impossible<(), Error>

§

fn serialize_i8( self, value: i8, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_bytes( self, val: &[u8], ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_bool( self, _val: bool, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_i16( self, _val: i16, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_i32( self, _val: i32, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_i64( self, _val: i64, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u8( self, _val: u8, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u16( self, _val: u16, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u32( self, _val: u32, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u64( self, _val: u64, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_f32( self, _val: f32, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_f64( self, _val: f64, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_char( self, _val: char, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_str( self, _val: &str, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_unit( self, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_unit_struct( self, _name: &'static str, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_unit_variant( self, _name: &'static str, _idx: u32, _variant: &'static str, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_newtype_struct<T>( self, _name: &'static str, _value: &T, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_newtype_variant<T>( self, _name: &'static str, _idx: u32, _variant: &'static str, _value: &T, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_none( self, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_some<T>( self, _value: &T, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::Ok, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_seq( self, _len: Option<usize>, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::SerializeSeq, <&mut ExtFieldSerializer<'a, W> as Serializer>::Error>

§

fn serialize_tuple( self, _len: usize, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::SerializeTuple, Error>

§

fn serialize_tuple_struct( self, _name: &'static str, _len: usize, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::SerializeTupleStruct, Error>

§

fn serialize_tuple_variant( self, _name: &'static str, _idx: u32, _variant: &'static str, _len: usize, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::SerializeTupleVariant, Error>

§

fn serialize_map( self, _len: Option<usize>, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::SerializeMap, Error>

§

fn serialize_struct( self, _name: &'static str, _len: usize, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::SerializeStruct, Error>

§

fn serialize_struct_variant( self, _name: &'static str, _idx: u32, _variant: &'static str, _len: usize, ) -> Result<<&mut ExtFieldSerializer<'a, W> as Serializer>::SerializeStructVariant, Error>

§

impl<'a, W> Serializer for &mut ExtSerializer<'a, W>
where W: Write + 'a,

§

type Ok = ()

§

type Error = Error

§

type SerializeSeq = Impossible<(), Error>

§

type SerializeTuple = &mut ExtSerializer<'a, W>

§

type SerializeTupleStruct = Impossible<(), Error>

§

type SerializeTupleVariant = Impossible<(), Error>

§

type SerializeMap = Impossible<(), Error>

§

type SerializeStruct = Impossible<(), Error>

§

type SerializeStructVariant = Impossible<(), Error>

§

fn serialize_bytes( self, _val: &[u8], ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_bool( self, _val: bool, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_i8( self, _value: i8, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_i16( self, _val: i16, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_i32( self, _val: i32, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_i64( self, _val: i64, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u8( self, _val: u8, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u16( self, _val: u16, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u32( self, _val: u32, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_u64( self, _val: u64, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_f32( self, _val: f32, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_f64( self, _val: f64, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_char( self, _val: char, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_str( self, _val: &str, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_unit( self, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_unit_struct( self, _name: &'static str, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_unit_variant( self, _name: &'static str, _idx: u32, _variant: &'static str, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_newtype_struct<T>( self, _name: &'static str, _value: &T, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_newtype_variant<T>( self, _name: &'static str, _idx: u32, _variant: &'static str, _value: &T, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_none( self, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_some<T>( self, _value: &T, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::Ok, <&mut ExtSerializer<'a, W> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_seq( self, _len: Option<usize>, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::SerializeSeq, <&mut ExtSerializer<'a, W> as Serializer>::Error>

§

fn serialize_tuple( self, _len: usize, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::SerializeTuple, Error>

§

fn serialize_tuple_struct( self, _name: &'static str, _len: usize, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::SerializeTupleStruct, Error>

§

fn serialize_tuple_variant( self, _name: &'static str, _idx: u32, _variant: &'static str, _len: usize, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::SerializeTupleVariant, Error>

§

fn serialize_map( self, _len: Option<usize>, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::SerializeMap, Error>

§

fn serialize_struct( self, _name: &'static str, _len: usize, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::SerializeStruct, Error>

§

fn serialize_struct_variant( self, _name: &'static str, _idx: u32, _variant: &'static str, _len: usize, ) -> Result<<&mut ExtSerializer<'a, W> as Serializer>::SerializeStructVariant, Error>

§

impl<'a, W, C> Serializer for &'a mut Serializer<W, C>
where W: Write, C: SerializerConfig,

§

type Ok = ()

§

type Error = Error

§

type SerializeSeq = MaybeUnknownLengthCompound<'a, W, C>

§

type SerializeTuple = Tuple<'a, W, C>

§

type SerializeTupleStruct = Compound<'a, W, C>

§

type SerializeTupleVariant = Compound<'a, W, C>

§

type SerializeMap = MaybeUnknownLengthCompound<'a, W, C>

§

type SerializeStruct = Compound<'a, W, C>

§

type SerializeStructVariant = Compound<'a, W, C>

§

fn is_human_readable(&self) -> bool

§

fn serialize_bool( self, v: bool, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_i8( self, v: i8, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_i16( self, v: i16, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_i32( self, v: i32, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_i64( self, v: i64, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_i128( self, v: i128, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_u8( self, v: u8, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_u16( self, v: u16, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_u32( self, v: u32, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_u64( self, v: u64, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_u128( self, v: u128, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_f32( self, v: f32, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_f64( self, v: f64, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_char( self, v: char, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_str( self, v: &str, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_bytes( self, value: &[u8], ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_none( self, ) -> Result<(), <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_some<T>( self, v: &T, ) -> Result<(), <&'a mut Serializer<W, C> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_unit( self, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_unit_struct( self, _name: &'static str, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_unit_variant( self, _name: &str, _: u32, variant: &'static str, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_newtype_struct<T>( self, name: &'static str, value: &T, ) -> Result<(), <&'a mut Serializer<W, C> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_newtype_variant<T>( self, _name: &'static str, _: u32, variant: &'static str, value: &T, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>
where T: Serialize + ?Sized,

§

fn serialize_seq( self, len: Option<usize>, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::SerializeSeq, Error>

§

fn serialize_tuple( self, len: usize, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::SerializeTuple, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_tuple_struct( self, _name: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::SerializeTupleStruct, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_tuple_variant( self, _name: &'static str, _: u32, variant: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::SerializeTupleVariant, Error>

§

fn serialize_map( self, len: Option<usize>, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::SerializeMap, Error>

§

fn serialize_struct( self, _name: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::SerializeStruct, <&'a mut Serializer<W, C> as Serializer>::Error>

§

fn serialize_struct_variant( self, name: &'static str, _: u32, variant: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::SerializeStructVariant, Error>

§

fn collect_seq<I>( self, iter: I, ) -> Result<<&'a mut Serializer<W, C> as Serializer>::Ok, <&'a mut Serializer<W, C> as Serializer>::Error>

source§

impl<'a, W, F> Serializer for &'a mut Serializer<W, F>
where W: Write, F: Formatter,

source§

fn serialize_newtype_struct<T>( self, _name: &'static str, value: &T, ) -> Result<(), Error>
where T: Serialize + ?Sized,

Serialize newtypes without an object wrapper.

source§

type Ok = ()

source§

type Error = Error

source§

type SerializeSeq = Compound<'a, W, F>

source§

type SerializeTuple = Compound<'a, W, F>

source§

type SerializeTupleStruct = Compound<'a, W, F>

source§

type SerializeTupleVariant = Compound<'a, W, F>

source§

type SerializeMap = Compound<'a, W, F>

source§

type SerializeStruct = Compound<'a, W, F>

source§

type SerializeStructVariant = Compound<'a, W, F>

source§

fn serialize_bool(self, value: bool) -> Result<(), Error>

source§

fn serialize_i8(self, value: i8) -> Result<(), Error>

source§

fn serialize_i16(self, value: i16) -> Result<(), Error>

source§

fn serialize_i32(self, value: i32) -> Result<(), Error>

source§

fn serialize_i64(self, value: i64) -> Result<(), Error>

source§

fn serialize_i128(self, value: i128) -> Result<(), Error>

source§

fn serialize_u8(self, value: u8) -> Result<(), Error>

source§

fn serialize_u16(self, value: u16) -> Result<(), Error>

source§

fn serialize_u32(self, value: u32) -> Result<(), Error>

source§

fn serialize_u64(self, value: u64) -> Result<(), Error>

source§

fn serialize_u128(self, value: u128) -> Result<(), Error>

source§

fn serialize_f32(self, value: f32) -> Result<(), Error>

source§

fn serialize_f64(self, value: f64) -> Result<(), Error>

source§

fn serialize_char(self, value: char) -> Result<(), Error>

source§

fn serialize_str(self, value: &str) -> Result<(), Error>

source§

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

source§

fn serialize_unit(self) -> Result<(), Error>

source§

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

source§

fn serialize_unit_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, ) -> Result<(), Error>

source§

fn serialize_newtype_variant<T>( self, _name: &'static str, _variant_index: u32, variant: &'static str, value: &T, ) -> Result<(), Error>
where T: Serialize + ?Sized,

source§

fn serialize_none(self) -> Result<(), Error>

source§

fn serialize_some<T>(self, value: &T) -> Result<(), Error>
where T: Serialize + ?Sized,

source§

fn serialize_seq( self, len: Option<usize>, ) -> Result<<&'a mut Serializer<W, F> as Serializer>::SerializeSeq, Error>

source§

fn serialize_tuple( self, len: usize, ) -> Result<<&'a mut Serializer<W, F> as Serializer>::SerializeTuple, Error>

source§

fn serialize_tuple_struct( self, _name: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, F> as Serializer>::SerializeTupleStruct, Error>

source§

fn serialize_tuple_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, F> as Serializer>::SerializeTupleVariant, Error>

source§

fn serialize_map( self, len: Option<usize>, ) -> Result<<&'a mut Serializer<W, F> as Serializer>::SerializeMap, Error>

source§

fn serialize_struct( self, name: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, F> as Serializer>::SerializeStruct, Error>

source§

fn serialize_struct_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, len: usize, ) -> Result<<&'a mut Serializer<W, F> as Serializer>::SerializeStructVariant, Error>

source§

fn collect_str<T>(self, value: &T) -> Result<(), Error>
where T: Display + ?Sized,

§

impl<'input, 'output, Target> Serializer for Serializer<'input, 'output, Target>
where Target: 'output + Target,

§

fn serialize_bool( self, _v: bool, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_i8( self, _v: i8, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_i16( self, _v: i16, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_i32( self, _v: i32, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_i64( self, _v: i64, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_u8( self, _v: u8, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_u16( self, _v: u16, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_u32( self, _v: u32, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_u64( self, _v: u64, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_f32( self, _v: f32, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_f64( self, _v: f64, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_char( self, _v: char, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_str( self, _value: &str, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_bytes( self, _value: &[u8], ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_unit( self, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns Ok.

§

fn serialize_unit_struct( self, _name: &'static str, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns Ok.

§

fn serialize_unit_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns an error.

§

fn serialize_newtype_struct<T>( self, _name: &'static str, value: &T, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

Serializes the inner value, ignoring the newtype name.

§

fn serialize_newtype_variant<T>( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _value: &T, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

Returns an error.

§

fn serialize_none( self, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>

Returns Ok.

§

fn serialize_some<T>( self, value: &T, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::Ok, Error>
where T: Serialize + ?Sized,

Serializes the given value.

§

fn serialize_seq( self, _len: Option<usize>, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::SerializeSeq, Error>

Serialize a sequence, given length (if any) is ignored.

§

fn serialize_tuple( self, _len: usize, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::SerializeTuple, Error>

Returns an error.

§

fn serialize_tuple_struct( self, _name: &'static str, _len: usize, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::SerializeTupleStruct, Error>

Returns an error.

§

fn serialize_tuple_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _len: usize, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::SerializeTupleVariant, Error>

Returns an error.

§

fn serialize_map( self, _len: Option<usize>, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::SerializeMap, Error>

Serializes a map, given length is ignored.

§

fn serialize_struct( self, _name: &'static str, _len: usize, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::SerializeStruct, Error>

Serializes a struct, given length is ignored.

§

fn serialize_struct_variant( self, _name: &'static str, _variant_index: u32, _variant: &'static str, _len: usize, ) -> Result<<Serializer<'input, 'output, Target> as Serializer>::SerializeStructVariant, Error>

Returns an error.

§

type Ok = &'output mut Serializer<'input, Target>

§

type Error = Error

§

type SerializeSeq = SeqSerializer<'input, 'output, Target>

§

type SerializeTuple = TupleSerializer<'input, 'output, Target>

§

type SerializeTupleStruct = TupleStructSerializer<'input, 'output, Target>

§

type SerializeTupleVariant = TupleVariantSerializer<'input, 'output, Target>

§

type SerializeMap = MapSerializer<'input, 'output, Target>

§

type SerializeStruct = StructSerializer<'input, 'output, Target>

§

type SerializeStructVariant = StructVariantSerializer<'input, 'output, Target>

Implementors§