aboutsummaryrefslogtreecommitdiff
path: root/src/spanned.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2019-08-09 16:53:38 -0500
committerGitHub <noreply@github.com>2019-08-09 16:53:38 -0500
commitf56df234c0cfba94ac80d4ef603c1f82f28a12db (patch)
treebeefef1f2e1b18a575ae1587fd5e621991488bf5 /src/spanned.rs
parent5c6c3750727515fa4fc5bc3bc653293f5293f2c6 (diff)
parentb1aa4f7129e4a3a9d3f420881bff25fb95752626 (diff)
downloadmilf-rs-f56df234c0cfba94ac80d4ef603c1f82f28a12db.tar.gz
milf-rs-f56df234c0cfba94ac80d4ef603c1f82f28a12db.zip
Merge pull request #316 from pietroalbini/doc-spanned
Include Spanned in the docs
Diffstat (limited to 'src/spanned.rs')
-rw-r--r--src/spanned.rs41
1 files changed, 21 insertions, 20 deletions
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.