Modernize serde_test Token names
This commit is contained in:
parent
f03e8e6056
commit
b6605b57e0
@ -54,11 +54,13 @@ pub enum Token {
|
|||||||
/// A serialized `ByteBuf`
|
/// A serialized `ByteBuf`
|
||||||
ByteBuf(&'static [u8]),
|
ByteBuf(&'static [u8]),
|
||||||
|
|
||||||
/// The header to a serialized `Option<T>`.
|
/// The header to a serialized `Option<T>` containing some value.
|
||||||
///
|
///
|
||||||
/// `None` is serialized as `Option(false)`, while `Some` is serialized as `Option(true)`, then
|
/// The tokens of the value follow after this header.
|
||||||
/// the value contained in the option.
|
Some,
|
||||||
Option(bool),
|
|
||||||
|
/// A serialized `Option<T>` containing none.
|
||||||
|
None,
|
||||||
|
|
||||||
/// A serialized `()`.
|
/// A serialized `()`.
|
||||||
Unit,
|
Unit,
|
||||||
@ -70,52 +72,46 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// Newtype structs are serialized with this header, followed by the value contained in the
|
/// Newtype structs are serialized with this header, followed by the value contained in the
|
||||||
/// newtype struct.
|
/// newtype struct.
|
||||||
StructNewType(&'static str),
|
NewtypeStruct(&'static str),
|
||||||
|
|
||||||
/// The header to an enum of the given name.
|
/// The header to an enum of the given name.
|
||||||
///
|
Enum(&'static str),
|
||||||
/// 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.
|
|
||||||
EnumStart(&'static str),
|
|
||||||
|
|
||||||
/// A unit variant of an enum of the given name, of the given name.
|
/// 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
|
/// The first string represents the name of the enum, and the second represents the name of the
|
||||||
/// variant.
|
/// variant.
|
||||||
EnumUnit(&'static str, &'static str),
|
UnitVariant(&'static str, &'static str),
|
||||||
|
|
||||||
/// The header to a newtype variant of an enum of the given name, of the given name.
|
/// 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
|
/// 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`.
|
/// variant. The value contained within this enum works the same as `StructNewType`.
|
||||||
EnumNewType(&'static str, &'static str),
|
NewtypeVariant(&'static str, &'static str),
|
||||||
|
|
||||||
/// The header to a sequence of the given length.
|
/// The header to a sequence of the given length.
|
||||||
///
|
///
|
||||||
/// These are serialized via `serialize_seq`, which takes an optional length. After this
|
/// These are serialized via `serialize_seq`, which takes an optional length. After this
|
||||||
/// header is a list of elements, followed by `SeqEnd`.
|
/// header is a list of elements, followed by `SeqEnd`.
|
||||||
SeqStart(Option<usize>),
|
Seq(Option<usize>),
|
||||||
|
|
||||||
/// The header to an array of the given length.
|
/// The header to an array of the given length.
|
||||||
///
|
///
|
||||||
/// These are serialized via `serialize_seq_fized_size`, which requires a length. After this
|
/// These are serialized via `serialize_seq_fized_size`, which requires a length. After this
|
||||||
/// header is a list of elements, followed by `SeqEnd`.
|
/// header is a list of elements, followed by `SeqEnd`.
|
||||||
SeqArrayStart(usize),
|
SeqFixedSize(usize),
|
||||||
|
|
||||||
/// An indicator of the end of a sequence.
|
/// An indicator of the end of a sequence.
|
||||||
SeqEnd,
|
SeqEnd,
|
||||||
|
|
||||||
/// The header to a tuple of the given length, similar to `SeqArrayStart`.
|
/// The header to a tuple of the given length, similar to `SeqFixedSize`.
|
||||||
TupleStart(usize),
|
Tuple(usize),
|
||||||
|
|
||||||
/// An indicator of the end of a tuple, similar to `SeqEnd`.
|
/// An indicator of the end of a tuple, similar to `SeqEnd`.
|
||||||
TupleEnd,
|
TupleEnd,
|
||||||
|
|
||||||
/// The header to a tuple struct of the given name and length.
|
/// The header to a tuple struct of the given name and length.
|
||||||
TupleStructStart(&'static str, usize),
|
TupleStruct(&'static str, usize),
|
||||||
|
|
||||||
/// An indicator of the end of a tuple struct, similar to `TupleEnd`.
|
/// An indicator of the end of a tuple struct, similar to `TupleEnd`.
|
||||||
TupleStructEnd,
|
TupleStructEnd,
|
||||||
@ -124,27 +120,27 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// These are serialized via `serialize_map`, which takes an optional length. After this header
|
/// These are serialized via `serialize_map`, which takes an optional length. After this header
|
||||||
/// is a list of key-value pairs, followed by `MapEnd`.
|
/// is a list of key-value pairs, followed by `MapEnd`.
|
||||||
MapStart(Option<usize>),
|
Map(Option<usize>),
|
||||||
|
|
||||||
/// An indicator of the end of a map.
|
/// An indicator of the end of a map.
|
||||||
MapEnd,
|
MapEnd,
|
||||||
|
|
||||||
/// The header of a struct of the given name and length, similar to `MapStart`.
|
/// The header of a struct of the given name and length, similar to `Map`.
|
||||||
StructStart(&'static str, usize),
|
Struct(&'static str, usize),
|
||||||
|
|
||||||
/// An indicator of the end of a struct, similar to `MapEnd`.
|
/// An indicator of the end of a struct, similar to `MapEnd`.
|
||||||
StructEnd,
|
StructEnd,
|
||||||
|
|
||||||
/// The header to a tuple variant of an enum of the given name, of the given name and length.
|
/// The header to a tuple variant of an enum of the given name, of the given name and length.
|
||||||
EnumSeqStart(&'static str, &'static str, usize),
|
TupleVariant(&'static str, &'static str, usize),
|
||||||
|
|
||||||
/// An indicator of the end of a tuple variant, similar to `TupleEnd`.
|
/// An indicator of the end of a tuple variant, similar to `TupleEnd`.
|
||||||
EnumSeqEnd,
|
TupleVariantEnd,
|
||||||
|
|
||||||
/// The header of a struct variant of an enum of the given name, of the given name and length,
|
/// The header of a struct variant of an enum of the given name, of the given name and length,
|
||||||
/// similar to `StructStart`.
|
/// similar to `Struct`.
|
||||||
EnumMapStart(&'static str, &'static str, usize),
|
StructVariant(&'static str, &'static str, usize),
|
||||||
|
|
||||||
/// An indicator of the end of a struct, similar to `StructEnd`.
|
/// An indicator of the end of a struct, similar to `StructEnd`.
|
||||||
EnumMapEnd,
|
StructVariantEnd,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user