Struct serde_test::Serializer
[−]
[src]
pub struct Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>> { /* fields omitted */ }
Methods
impl<'a, I> Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
fn new(tokens: I) -> Serializer<'a, I>
fn next_token(&mut self) -> Option<&'a Token<'a>>
Trait Implementations
impl<'s, 'a, I> Serializer for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
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. Read more
type Error = Error
The error type when some error occurs during serialization.
type SerializeSeq = Self
Type returned from serialize_seq
and serialize_seq_fixed_size
for serializing the content of the sequence. Read more
type SerializeTuple = Self
Type returned from serialize_tuple
for serializing the content of the tuple. Read more
type SerializeTupleStruct = Self
Type returned from serialize_tuple_struct
for serializing the content of the tuple struct. Read more
type SerializeTupleVariant = Self
Type returned from serialize_tuple_variant
for serializing the content of the tuple variant. Read more
type SerializeMap = Self
Type returned from serialize_map
for serializing the content of the map. Read more
type SerializeStruct = Self
Type returned from serialize_struct
for serializing the content of the struct. Read more
type SerializeStructVariant = Self
Type returned from serialize_struct_variant
for serializing the content of the struct variant. Read more
fn serialize_bool(self, v: bool) -> Result<(), Error>
Serialize a bool
value.
fn serialize_i8(self, v: i8) -> Result<(), Error>
Serialize an i8
value. Read more
fn serialize_i16(self, v: i16) -> Result<(), Error>
Serialize an i16
value. Read more
fn serialize_i32(self, v: i32) -> Result<(), Error>
Serialize an i32
value. Read more
fn serialize_i64(self, v: i64) -> Result<(), Error>
Serialize an i64
value.
fn serialize_u8(self, v: u8) -> Result<(), Error>
Serialize a u8
value. Read more
fn serialize_u16(self, v: u16) -> Result<(), Error>
Serialize a u16
value. Read more
fn serialize_u32(self, v: u32) -> Result<(), Error>
Serialize a u32
value. Read more
fn serialize_u64(self, v: u64) -> Result<(), Error>
Serialize a u64
value.
fn serialize_f32(self, v: f32) -> Result<(), Error>
Serialize an f32
value. Read more
fn serialize_f64(self, v: f64) -> Result<(), Error>
Serialize an f64
value.
fn serialize_char(self, v: char) -> Result<(), Error>
Serialize a character. Read more
fn serialize_str(self, v: &str) -> Result<(), Error>
Serialize a &str
.
fn serialize_bytes(self, value: &[u8]) -> Result<(), Self::Error>
Serialize a chunk of raw byte data. Read more
fn serialize_unit(self) -> Result<(), Error>
Serialize a ()
value.
fn serialize_unit_struct(self, name: &str) -> Result<(), Error>
Serialize a unit struct like struct Unit
or PhantomData<T>
. Read more
fn serialize_unit_variant(self,
name: &str,
_variant_index: usize,
variant: &str)
-> Result<(), Error>
name: &str,
_variant_index: usize,
variant: &str)
-> Result<(), Error>
Serialize a unit variant like E::A
in enum E { A, B }
. Read more
fn serialize_newtype_struct<T: ?Sized>(self,
name: &'static str,
value: &T)
-> Result<(), Error> where T: Serialize
name: &'static str,
value: &T)
-> Result<(), Error> where T: Serialize
Serialize a newtype struct like struct Millimeters(u8)
. Read more
fn serialize_newtype_variant<T: ?Sized>(self,
name: &str,
_variant_index: usize,
variant: &str,
value: &T)
-> Result<(), Error> where T: Serialize
name: &str,
_variant_index: usize,
variant: &str,
value: &T)
-> Result<(), Error> where T: Serialize
Serialize a newtype variant like E::N
in enum E { N(u8) }
. Read more
fn serialize_none(self) -> Result<(), Error>
Serialize a None
value.
fn serialize_some<T: ?Sized>(self, value: &T) -> Result<(), Error> where T: Serialize
Serialize a Some(T)
value.
fn serialize_seq(self, len: Option<usize>) -> Result<Self, Error>
Begin to serialize a dynamically sized sequence. This call must be followed by zero or more calls to serialize_element
, then a call to end
. Read more
fn serialize_seq_fixed_size(self, len: usize) -> Result<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
. Read more
fn serialize_tuple(self, len: usize) -> Result<Self, Error>
Begin to serialize a tuple. This call must be followed by zero or more calls to serialize_field
, then a call to end
. Read more
fn serialize_tuple_struct(self,
name: &'static str,
len: usize)
-> Result<Self, Error>
name: &'static str,
len: usize)
-> Result<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
. Read more
fn serialize_tuple_variant(self,
name: &str,
_variant_index: usize,
variant: &str,
len: usize)
-> Result<Self, Error>
name: &str,
_variant_index: usize,
variant: &str,
len: usize)
-> Result<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
. Read more
fn serialize_map(self, len: Option<usize>) -> Result<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
. Read more
fn serialize_struct(self, name: &str, len: usize) -> Result<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
. Read more
fn serialize_struct_variant(self,
name: &str,
_variant_index: usize,
variant: &str,
len: usize)
-> Result<Self, Error>
name: &str,
_variant_index: usize,
variant: &str,
len: usize)
-> Result<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
. Read more
fn collect_seq<I>(self, iter: I) -> Result<Self::Ok, Self::Error> where I: IntoIterator, I::Item: Serialize
Collect an iterator as a sequence. Read more
fn collect_map<K, V, I>(self, iter: I) -> Result<Self::Ok, Self::Error> where I: IntoIterator<Item=(K, V)>, K: Serialize, V: Serialize
Collect an iterator as a map. Read more
impl<'s, 'a, I> SerializeSeq for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
type Ok = ()
Must match the Ok
type of our Serializer
.
type Error = Error
Must match the Error
type of our Serializer
.
fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Error> where T: Serialize
Serialize a sequence element.
fn end(self) -> Result<(), Error>
Finish serializing a sequence.
impl<'s, 'a, I> SerializeTuple for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
type Ok = ()
Must match the Ok
type of our Serializer
.
type Error = Error
Must match the Error
type of our Serializer
.
fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Error> where T: Serialize
Serialize a tuple element.
fn end(self) -> Result<(), Error>
Finish serializing a tuple.
impl<'s, 'a, I> SerializeTupleStruct for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
type Ok = ()
Must match the Ok
type of our Serializer
.
type Error = Error
Must match the Error
type of our Serializer
.
fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Error> where T: Serialize
Serialize a tuple struct field.
fn end(self) -> Result<(), Error>
Finish serializing a tuple struct.
impl<'s, 'a, I> SerializeTupleVariant for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
type Ok = ()
Must match the Ok
type of our Serializer
.
type Error = Error
Must match the Error
type of our Serializer
.
fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Error> where T: Serialize
Serialize a tuple variant field.
fn end(self) -> Result<(), Error>
Finish serializing a tuple variant.
impl<'s, 'a, I> SerializeMap for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
type Ok = ()
Must match the Ok
type of our Serializer
.
type Error = Error
Must match the Error
type of our Serializer
.
fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), Self::Error> where T: Serialize
Serialize a map key.
fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error> where T: Serialize
Serialize a map value.
fn end(self) -> Result<(), Self::Error>
Finish serializing a map.
fn serialize_entry<K, V>(&mut self,
key: &K,
value: &V)
-> Result<(), Self::Error> where K: Serialize + ?Sized, V: Serialize + ?Sized
key: &K,
value: &V)
-> Result<(), Self::Error> where K: Serialize + ?Sized, V: Serialize + ?Sized
Serialize a map entry consisting of a key and a value. Read more
impl<'s, 'a, I> SerializeStruct for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
type Ok = ()
Must match the Ok
type of our Serializer
.
type Error = Error
Must match the Error
type of our Serializer
.
fn serialize_field<T: ?Sized>(&mut self,
key: &'static str,
value: &T)
-> Result<(), Self::Error> where T: Serialize
key: &'static str,
value: &T)
-> Result<(), Self::Error> where T: Serialize
Serialize a struct field.
fn end(self) -> Result<(), Self::Error>
Finish serializing a struct.
impl<'s, 'a, I> SerializeStructVariant for &'s mut Serializer<'a, I> where I: Iterator<Item=&'a Token<'a>>
[src]
type Ok = ()
Must match the Ok
type of our Serializer
.
type Error = Error
Must match the Error
type of our Serializer
.
fn serialize_field<T: ?Sized>(&mut self,
key: &'static str,
value: &T)
-> Result<(), Self::Error> where T: Serialize
key: &'static str,
value: &T)
-> Result<(), Self::Error> where T: Serialize
Serialize a struct variant field.
fn end(self) -> Result<(), Self::Error>
Finish serializing a struct variant.