Struct marked_yaml::Spanned
source · pub struct Spanned<T> { /* private fields */ }
Available on crate feature
serde
only.Expand description
Wrapper which can be used when deserialising data from Node
You must use a compatible deserializer if you want to deserialize these values.
use marked_yaml::{from_yaml, Spanned};
use serde::Deserialize;
#[derive(Deserialize)]
struct MyStuff {
num: Spanned<u32>,
}
let stuff: MyStuff = from_yaml(0, "num: 12").unwrap();
You can also serialize these values, however when serializing you will lose the span information so do not expect to round-trip these values.
Implementations§
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Spanned<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Spanned<T>where
T: Deserialize<'de>,
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<&str> for Spanned<String>
impl PartialEq<&str> for Spanned<String>
source§impl<T> PartialEq for Spanned<T>where
T: PartialEq,
impl<T> PartialEq for Spanned<T>where
T: PartialEq,
impl<T> Eq for Spanned<T>where
T: Eq,
Auto Trait Implementations§
impl<T> Freeze for Spanned<T>where
T: Freeze,
impl<T> RefUnwindSafe for Spanned<T>where
T: RefUnwindSafe,
impl<T> Send for Spanned<T>where
T: Send,
impl<T> Sync for Spanned<T>where
T: Sync,
impl<T> Unpin for Spanned<T>where
T: Unpin,
impl<T> UnwindSafe for Spanned<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more