Update serde_test examples to 2018 edition
This commit is contained in:
parent
95d0f437e3
commit
e71b8598ae
@ -15,7 +15,7 @@ include = ["Cargo.toml", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-AP
|
|||||||
serde = { version = "1.0.60", path = "../serde" }
|
serde = { version = "1.0.60", path = "../serde" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde = { version = "1.0", path = "../serde", features = ["rc"] }
|
serde = { version = "1.0", path = "../serde", features = ["rc", "derive"] }
|
||||||
serde_derive = { version = "1.0", path = "../serde_derive" }
|
serde_derive = { version = "1.0", path = "../serde_derive" }
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
|
@ -8,13 +8,8 @@ use std::fmt::Debug;
|
|||||||
|
|
||||||
/// Runs both `assert_ser_tokens` and `assert_de_tokens`.
|
/// Runs both `assert_ser_tokens` and `assert_de_tokens`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -45,13 +40,8 @@ where
|
|||||||
|
|
||||||
/// Asserts that `value` serializes to the given `tokens`.
|
/// Asserts that `value` serializes to the given `tokens`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_ser_tokens, Token};
|
/// # use serde_test::{assert_ser_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -90,16 +80,11 @@ where
|
|||||||
/// Asserts that `value` serializes to the given `tokens`, and then yields
|
/// Asserts that `value` serializes to the given `tokens`, and then yields
|
||||||
/// `error`.
|
/// `error`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # fn main() {
|
|
||||||
/// use std::sync::{Arc, Mutex};
|
/// use std::sync::{Arc, Mutex};
|
||||||
/// use std::thread;
|
/// use std::thread;
|
||||||
///
|
///
|
||||||
|
/// use serde::Serialize;
|
||||||
/// use serde_test::{assert_ser_tokens_error, Token};
|
/// use serde_test::{assert_ser_tokens_error, Token};
|
||||||
///
|
///
|
||||||
/// #[derive(Serialize)]
|
/// #[derive(Serialize)]
|
||||||
@ -107,6 +92,7 @@ where
|
|||||||
/// lock: Arc<Mutex<u32>>,
|
/// lock: Arc<Mutex<u32>>,
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
/// fn main() {
|
||||||
/// let example = Example { lock: Arc::new(Mutex::new(0)) };
|
/// let example = Example { lock: Arc::new(Mutex::new(0)) };
|
||||||
/// let lock = example.lock.clone();
|
/// let lock = example.lock.clone();
|
||||||
///
|
///
|
||||||
@ -126,7 +112,7 @@ where
|
|||||||
/// ];
|
/// ];
|
||||||
/// let error = "lock poison error while serializing";
|
/// let error = "lock poison error while serializing";
|
||||||
/// assert_ser_tokens_error(&example, expected, error);
|
/// assert_ser_tokens_error(&example, expected, error);
|
||||||
/// # }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn assert_ser_tokens_error<T>(value: &T, tokens: &[Token], error: &str)
|
pub fn assert_ser_tokens_error<T>(value: &T, tokens: &[Token], error: &str)
|
||||||
where
|
where
|
||||||
@ -145,13 +131,8 @@ where
|
|||||||
|
|
||||||
/// Asserts that the given `tokens` deserialize into `value`.
|
/// Asserts that the given `tokens` deserialize into `value`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_de_tokens, Token};
|
/// # use serde_test::{assert_de_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -205,13 +186,8 @@ where
|
|||||||
|
|
||||||
/// Asserts that the given `tokens` yield `error` when deserializing.
|
/// Asserts that the given `tokens` yield `error` when deserializing.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_de_tokens_error, Token};
|
/// # use serde_test::{assert_de_tokens_error, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
|
@ -14,10 +14,7 @@ pub struct Compact<T: ?Sized>(T);
|
|||||||
/// Trait to determine whether a value is represented in human-readable or
|
/// Trait to determine whether a value is represented in human-readable or
|
||||||
/// compact form.
|
/// compact form.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```edition2018
|
||||||
/// extern crate serde;
|
|
||||||
/// extern crate serde_test;
|
|
||||||
///
|
|
||||||
/// use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
/// use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
/// use serde_test::{assert_tokens, Configure, Token};
|
/// use serde_test::{assert_tokens, Configure, Token};
|
||||||
///
|
///
|
||||||
|
@ -24,19 +24,10 @@
|
|||||||
//!
|
//!
|
||||||
//! [`linked-hash-map`]: https://github.com/contain-rs/linked-hash-map
|
//! [`linked-hash-map`]: https://github.com/contain-rs/linked-hash-map
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```edition2018
|
||||||
//! # extern crate serde;
|
//! # const IGNORE: &str = stringify! {
|
||||||
//! #
|
|
||||||
//! # macro_rules! ignore {
|
|
||||||
//! # ($($tt:tt)+) => {}
|
|
||||||
//! # }
|
|
||||||
//! #
|
|
||||||
//! # ignore! {
|
|
||||||
//! extern crate linked_hash_map;
|
|
||||||
//! use linked_hash_map::LinkedHashMap;
|
//! use linked_hash_map::LinkedHashMap;
|
||||||
//! # }
|
//! # };
|
||||||
//!
|
|
||||||
//! extern crate serde_test;
|
|
||||||
//! use serde_test::{Token, assert_tokens};
|
//! use serde_test::{Token, assert_tokens};
|
||||||
//!
|
//!
|
||||||
//! # use std::fmt;
|
//! # use std::fmt;
|
||||||
|
@ -4,7 +4,7 @@ use std::fmt::{self, Debug, Display};
|
|||||||
pub enum Token {
|
pub enum Token {
|
||||||
/// A serialized `bool`.
|
/// A serialized `bool`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&true, &[Token::Bool(true)]);
|
/// assert_tokens(&true, &[Token::Bool(true)]);
|
||||||
@ -13,7 +13,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `i8`.
|
/// A serialized `i8`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0i8, &[Token::I8(0)]);
|
/// assert_tokens(&0i8, &[Token::I8(0)]);
|
||||||
@ -22,7 +22,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `i16`.
|
/// A serialized `i16`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0i16, &[Token::I16(0)]);
|
/// assert_tokens(&0i16, &[Token::I16(0)]);
|
||||||
@ -31,7 +31,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `i32`.
|
/// A serialized `i32`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0i32, &[Token::I32(0)]);
|
/// assert_tokens(&0i32, &[Token::I32(0)]);
|
||||||
@ -40,7 +40,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `i64`.
|
/// A serialized `i64`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0i64, &[Token::I64(0)]);
|
/// assert_tokens(&0i64, &[Token::I64(0)]);
|
||||||
@ -49,7 +49,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `u8`.
|
/// A serialized `u8`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0u8, &[Token::U8(0)]);
|
/// assert_tokens(&0u8, &[Token::U8(0)]);
|
||||||
@ -58,7 +58,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `u16`.
|
/// A serialized `u16`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0u16, &[Token::U16(0)]);
|
/// assert_tokens(&0u16, &[Token::U16(0)]);
|
||||||
@ -67,7 +67,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `u32`.
|
/// A serialized `u32`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0u32, &[Token::U32(0)]);
|
/// assert_tokens(&0u32, &[Token::U32(0)]);
|
||||||
@ -76,7 +76,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `u64`.
|
/// A serialized `u64`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0u64, &[Token::U64(0)]);
|
/// assert_tokens(&0u64, &[Token::U64(0)]);
|
||||||
@ -85,7 +85,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `f32`.
|
/// A serialized `f32`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0f32, &[Token::F32(0.0)]);
|
/// assert_tokens(&0f32, &[Token::F32(0.0)]);
|
||||||
@ -94,7 +94,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `f64`.
|
/// A serialized `f64`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&0f64, &[Token::F64(0.0)]);
|
/// assert_tokens(&0f64, &[Token::F64(0.0)]);
|
||||||
@ -103,7 +103,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `char`.
|
/// A serialized `char`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&'\n', &[Token::Char('\n')]);
|
/// assert_tokens(&'\n', &[Token::Char('\n')]);
|
||||||
@ -112,7 +112,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `str`.
|
/// A serialized `str`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// let s = String::from("transient");
|
/// let s = String::from("transient");
|
||||||
@ -122,7 +122,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A borrowed `str`.
|
/// A borrowed `str`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// let s: &str = "borrowed";
|
/// let s: &str = "borrowed";
|
||||||
@ -132,7 +132,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `String`.
|
/// A serialized `String`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// let s = String::from("owned");
|
/// let s = String::from("owned");
|
||||||
@ -151,7 +151,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `Option<T>` containing none.
|
/// A serialized `Option<T>` containing none.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// let opt = None::<char>;
|
/// let opt = None::<char>;
|
||||||
@ -163,7 +163,7 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// The tokens of the value follow after this header.
|
/// The tokens of the value follow after this header.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// let opt = Some('c');
|
/// let opt = Some('c');
|
||||||
@ -176,7 +176,7 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized `()`.
|
/// A serialized `()`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// assert_tokens(&(), &[Token::Unit]);
|
/// assert_tokens(&(), &[Token::Unit]);
|
||||||
@ -185,13 +185,8 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A serialized unit struct of the given name.
|
/// A serialized unit struct of the given name.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -205,13 +200,8 @@ pub enum Token {
|
|||||||
|
|
||||||
/// A unit variant of an enum.
|
/// A unit variant of an enum.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -233,13 +223,8 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// After this header is the value contained in the newtype struct.
|
/// After this header is the value contained in the newtype struct.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -259,13 +244,8 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// After this header is the value contained in the newtype variant.
|
/// After this header is the value contained in the newtype variant.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -291,7 +271,7 @@ pub enum Token {
|
|||||||
/// After this header are the elements of the sequence, followed by
|
/// After this header are the elements of the sequence, followed by
|
||||||
/// `SeqEnd`.
|
/// `SeqEnd`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// let vec = vec!['a', 'b', 'c'];
|
/// let vec = vec!['a', 'b', 'c'];
|
||||||
@ -312,7 +292,7 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// After this header are the elements of the tuple, followed by `TupleEnd`.
|
/// After this header are the elements of the tuple, followed by `TupleEnd`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// let tuple = ('a', 100);
|
/// let tuple = ('a', 100);
|
||||||
@ -333,13 +313,8 @@ pub enum Token {
|
|||||||
/// After this header are the fields of the tuple struct, followed by
|
/// After this header are the fields of the tuple struct, followed by
|
||||||
/// `TupleStructEnd`.
|
/// `TupleStructEnd`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -365,13 +340,8 @@ pub enum Token {
|
|||||||
/// After this header are the fields of the tuple variant, followed by
|
/// After this header are the fields of the tuple variant, followed by
|
||||||
/// `TupleVariantEnd`.
|
/// `TupleVariantEnd`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -402,7 +372,7 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// After this header are the entries of the map, followed by `MapEnd`.
|
/// After this header are the entries of the map, followed by `MapEnd`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// use std::collections::BTreeMap;
|
/// use std::collections::BTreeMap;
|
||||||
@ -429,13 +399,8 @@ pub enum Token {
|
|||||||
///
|
///
|
||||||
/// After this header are the fields of the struct, followed by `StructEnd`.
|
/// After this header are the fields of the struct, followed by `StructEnd`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -466,13 +431,8 @@ pub enum Token {
|
|||||||
/// After this header are the fields of the struct variant, followed by
|
/// After this header are the fields of the struct variant, followed by
|
||||||
/// `StructVariantEnd`.
|
/// `StructVariantEnd`.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
@ -501,13 +461,8 @@ pub enum Token {
|
|||||||
|
|
||||||
/// The header to an enum of the given name.
|
/// The header to an enum of the given name.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```edition2018
|
||||||
/// # #[macro_use]
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// # extern crate serde_derive;
|
|
||||||
/// #
|
|
||||||
/// # extern crate serde;
|
|
||||||
/// # extern crate serde_test;
|
|
||||||
/// #
|
|
||||||
/// # use serde_test::{assert_tokens, Token};
|
/// # use serde_test::{assert_tokens, Token};
|
||||||
/// #
|
/// #
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user