Enum serde_test::Token
[−]
[src]
pub enum Token<'a> { Bool(bool), I8(i8), I16(i16), I32(i32), I64(i64), U8(u8), U16(u16), U32(u32), U64(u64), F32(f32), F64(f64), Char(char), Str(&'a str), String(String), Bytes(&'a [u8]), ByteBuf(Vec<u8>), Option(bool), Unit, UnitStruct(&'a str), StructNewType(&'a str), EnumStart(&'a str), EnumUnit(&'a str, &'a str), EnumNewType(&'a str, &'a str), SeqStart(Option<usize>), SeqArrayStart(usize), SeqSep, SeqEnd, TupleStart(usize), TupleSep, TupleEnd, TupleStructStart(&'a str, usize), TupleStructSep, TupleStructEnd, MapStart(Option<usize>), MapSep, MapEnd, StructStart(&'a str, usize), StructSep, StructEnd, EnumSeqStart(&'a str, &'a str, usize), EnumSeqSep, EnumSeqEnd, EnumMapStart(&'a str, &'a str, usize), EnumMapSep, EnumMapEnd, }
Variants
Bool(bool)
A serialized bool
.
I8(i8)
A serialized i8
.
I16(i16)
A serialized i16
.
I32(i32)
A serialized i32
.
I64(i64)
A serialized i64
.
U8(u8)
A serialized u8
.
U16(u16)
A serialized u16
.
U32(u32)
A serialized u32
.
U64(u64)
A serialized u64
.
F32(f32)
A serialized f32
.
F64(f64)
A serialized f64
.
Char(char)
A serialized char
.
Str(&'a str)
A serialized str
.
String(String)
A serialized String
.
Bytes(&'a [u8])
A serialized [u8]
ByteBuf(Vec<u8>)
A serialized ByteBuf
Option(bool)
The header to a serialized Option<T>
.
None
is serialized as Option(false)
, while Some
is serialized as Option(true)
, then
the value contained in the option.
Unit
A serialized ()
.
UnitStruct(&'a str)
A serialized unit struct of the given name.
StructNewType(&'a str)
The header to a serialized newtype struct of the given name.
Newtype structs are serialized with this header, followed by the value contained in the newtype struct.
EnumStart(&'a str)
The header to an enum of the given name.
This token is only used for deserializers, and ensures that the following tokens are read as
an enum. Because this is never emitted by serializers, calling assert_ser_tokens
or
assert_tokens
will fail if this token is used.
TODO: Trash this.
EnumUnit(&'a str, &'a str)
A unit variant of an enum of the given name, of the given name.
The first string represents the name of the enum, and the second represents the name of the variant.
EnumNewType(&'a str, &'a str)
The header to a newtype variant of an enum of the given name, of the given name.
The first string represents the name of the enum, and the second represents the name of the
variant. The value contained within this enum works the same as StructNewType
.
SeqStart(Option<usize>)
The header to a sequence of the given length.
These are serialized via serialize_seq
, which takes an optional length. After this
header is a list of elements, followed by SeqEnd
.
SeqArrayStart(usize)
The header to an array of the given length.
These are serialized via serialize_seq_fized_size
, which requires a length. After this
header is a list of elements, followed by SeqEnd
.
SeqSep
A separator, which occurs before every element in a sequence.
Elements in sequences are represented by a SeqSep
, followed by the value of the element.
SeqEnd
An indicator of the end of a sequence.
TupleStart(usize)
The header to a tuple of the given length, similar to SeqArrayStart
.
TupleSep
A separator, similar to SeqSep
.
TupleEnd
An indicator of the end of a tuple, similar to SeqEnd
.
TupleStructStart(&'a str, usize)
The header to a tuple struct of the given name and length.
TupleStructSep
A separator, similar to TupleSep
.
TupleStructEnd
An indicator of the end of a tuple struct, similar to TupleEnd
.
MapStart(Option<usize>)
The header to a map of the given length.
These are serialized via serialize_map
, which takes an optional length. After this header
is a list of key-value pairs, followed by MapEnd
.
MapSep
A separator, which occurs before every key-value pair in a map.
Elements in maps are represented by a MapSep
, followed by a serialized key, followed
by a serialized value.
MapEnd
An indicator of the end of a map.
StructStart(&'a str, usize)
The header of a struct of the given name and length, similar to MapStart
.
StructSep
A separator, similar to MapSep
.
StructEnd
An indicator of the end of a struct, similar to MapEnd
.
EnumSeqStart(&'a str, &'a str, usize)
The header to a tuple variant of an enum of the given name, of the given name and length.
EnumSeqSep
A separator, similar to TupleSep
.
EnumSeqEnd
An indicator of the end of a tuple variant, similar to TupleEnd
.
EnumMapStart(&'a str, &'a str, usize)
The header of a struct variant of an enum of the given name, of the given name and length,
similar to StructStart
.
EnumMapSep
A separator, similar to StructSep
.
EnumMapEnd
An indicator of the end of a struct, similar to StructEnd
.
Trait Implementations
impl<'a> Clone for Token<'a>
[src]
fn clone(&self) -> Token<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> PartialEq for Token<'a>
[src]
fn eq(&self, __arg_0: &Token<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Token<'a>) -> bool
This method tests for !=
.