diff options
-rw-r--r-- | src/de.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 1 | ||||
-rw-r--r-- | src/ser.rs | 6 | ||||
-rw-r--r-- | src/spanned.rs | 41 |
4 files changed, 25 insertions, 25 deletions
@@ -296,7 +296,7 @@ struct Table<'a> { } #[doc(hidden)] -pub struct MapVisitor<'de: 'b, 'b> { +pub struct MapVisitor<'de, 'b> { values: vec::IntoIter<(Cow<'de, str>, Value<'de>)>, next_value: Option<(Cow<'de, str>, Value<'de>)>, depth: usize, @@ -166,5 +166,4 @@ mod tokens; pub mod macros; mod spanned; -#[doc(no_inline)] pub use crate::spanned::Spanned; @@ -222,7 +222,7 @@ enum State<'a> { } #[doc(hidden)] -pub struct SerializeSeq<'a: 'b, 'b> { +pub struct SerializeSeq<'a, 'b> { ser: &'b mut Serializer<'a>, first: Cell<bool>, type_: Cell<Option<&'static str>>, @@ -230,7 +230,7 @@ pub struct SerializeSeq<'a: 'b, 'b> { } #[doc(hidden)] -pub enum SerializeTable<'a: 'b, 'b> { +pub enum SerializeTable<'a, 'b> { Datetime(&'b mut Serializer<'a>), Table { ser: &'b mut Serializer<'a>, @@ -1186,7 +1186,7 @@ impl<'a, 'b> ser::SerializeStruct for SerializeTable<'a, 'b> { } } -struct DateStrEmitter<'a: 'b, 'b>(&'b mut Serializer<'a>); +struct DateStrEmitter<'a, 'b>(&'b mut Serializer<'a>); impl<'a, 'b> ser::Serializer for DateStrEmitter<'a, 'b> { type Ok = (); diff --git a/src/spanned.rs b/src/spanned.rs index cd02c87..7cccb32 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -1,23 +1,3 @@ -//! ``` -//! use serde_derive::Deserialize; -//! use toml::Spanned; -//! -//! #[derive(Deserialize)] -//! struct Value { -//! s: Spanned<String>, -//! } -//! -//! fn main() { -//! let t = "s = \"value\"\n"; -//! -//! let u: Value = toml::from_str(t).unwrap(); -//! -//! assert_eq!(u.s.start(), 4); -//! assert_eq!(u.s.end(), 11); -//! assert_eq!(u.s.get_ref(), "value"); -//! assert_eq!(u.s.into_inner(), String::from("value")); -//! } -//! ``` use serde::{de, ser}; use std::fmt; @@ -32,6 +12,27 @@ pub const END: &'static str = "$__toml_private_end"; pub const VALUE: &'static str = "$__toml_private_value"; /// A spanned value, indicating the range at which it is defined in the source. +/// +/// ``` +/// use serde_derive::Deserialize; +/// use toml::Spanned; +/// +/// #[derive(Deserialize)] +/// struct Value { +/// s: Spanned<String>, +/// } +/// +/// fn main() { +/// let t = "s = \"value\"\n"; +/// +/// let u: Value = toml::from_str(t).unwrap(); +/// +/// assert_eq!(u.s.start(), 4); +/// assert_eq!(u.s.end(), 11); +/// assert_eq!(u.s.get_ref(), "value"); +/// assert_eq!(u.s.into_inner(), String::from("value")); +/// } +/// ``` #[derive(Debug)] pub struct Spanned<T> { /// The start range. |