pub struct Tagged<T>(pub T, pub Option<String>);Available on crate features
json or toml or yaml only.Expand description
A value and the tag written on its node, such as !override in
code_span_size: !override 0: Tagged(0, Some("!override".into())).
The tag is spelled as Tag::as_str spells it,
and the value is read from the same node without its tag. A node with no
tag reads as Tagged(value, None), and so does a value any other
Deserializer reads.
A tag inside a value serde buffers, such as an untagged enum or a
flattened field, is not passed on: the buffered value reads as
Tagged(value, None).
Tuple Fields§
§0: TThe value, read without its tag.
1: Option<String>The tag written on the node, if any.
Trait Implementations§
Source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for Tagged<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for Tagged<T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl<T: Eq> Eq for Tagged<T>
impl<T: PartialEq> StructuralPartialEq for Tagged<T>
Auto Trait Implementations§
impl<T> Forget for Tagged<T>
impl<T> Freeze for Tagged<T>where
T: Freeze,
impl<T> Move for Tagged<T>
impl<T> RefUnwindSafe for Tagged<T>where
T: RefUnwindSafe,
impl<T> Send for Tagged<T>where
T: Send,
impl<T> Sync for Tagged<T>where
T: Sync,
impl<T> Unpin for Tagged<T>where
T: Unpin,
impl<T> UnsafeUnpin for Tagged<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Tagged<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