Struct toml::Spanned [−][src]
pub struct Spanned<T> { /* fields omitted */ }
Expand description
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"));
}
Implementations
Consumes the spanned value and returns the contained value.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Spanned<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Spanned<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more