Struct serde_yaml::value::TaggedValue
source · [−]Expand description
A Tag
+ Value
representing a tagged YAML scalar, sequence, or mapping.
use serde_yaml::value::TaggedValue;
use std::collections::BTreeMap;
let yaml = "
scalar: !Thing x
sequence_flow: !Thing [first]
sequence_block: !Thing
- first
mapping_flow: !Thing {k: v}
mapping_block: !Thing
k: v
";
let data: BTreeMap<String, TaggedValue> = serde_yaml::from_str(yaml).unwrap();
assert!(data["scalar"].tag == "Thing");
assert!(data["sequence_flow"].tag == "Thing");
assert!(data["sequence_block"].tag == "Thing");
assert!(data["mapping_flow"].tag == "Thing");
assert!(data["mapping_block"].tag == "Thing");
// The leading '!' in tags are not significant. The following is also true.
assert!(data["scalar"].tag == "!Thing");
Fields
tag: Tag
value: Value
Trait Implementations
sourceimpl Clone for TaggedValue
impl Clone for TaggedValue
sourcefn clone(&self) -> TaggedValue
fn clone(&self) -> TaggedValue
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TaggedValue
impl Debug for TaggedValue
sourceimpl<'de> Deserialize<'de> for TaggedValue
impl<'de> Deserialize<'de> for TaggedValue
sourcefn 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
sourceimpl<'de> EnumAccess<'de> for &'de TaggedValue
impl<'de> EnumAccess<'de> for &'de TaggedValue
type Error = Error
type Error = Error
The error type that can be returned if some error occurs during deserialization. Read more
type Variant = &'de Value
type Variant = &'de Value
The Visitor
that will be used to deserialize the content of the enum
variant. Read more
sourcefn variant_seed<V>(self, seed: V) -> Result<(V::Value, Self::Variant), Error> where
V: DeserializeSeed<'de>,
fn variant_seed<V>(self, seed: V) -> Result<(V::Value, Self::Variant), Error> where
V: DeserializeSeed<'de>,
variant
is called to identify which variant to deserialize. Read more
sourceimpl<'de> EnumAccess<'de> for TaggedValue
impl<'de> EnumAccess<'de> for TaggedValue
type Error = Error
type Error = Error
The error type that can be returned if some error occurs during deserialization. Read more
type Variant = Value
type Variant = Value
The Visitor
that will be used to deserialize the content of the enum
variant. Read more
sourcefn variant_seed<V>(self, seed: V) -> Result<(V::Value, Self::Variant), Error> where
V: DeserializeSeed<'de>,
fn variant_seed<V>(self, seed: V) -> Result<(V::Value, Self::Variant), Error> where
V: DeserializeSeed<'de>,
variant
is called to identify which variant to deserialize. Read more
sourceimpl Hash for TaggedValue
impl Hash for TaggedValue
sourceimpl PartialEq<TaggedValue> for TaggedValue
impl PartialEq<TaggedValue> for TaggedValue
sourcefn eq(&self, other: &TaggedValue) -> bool
fn eq(&self, other: &TaggedValue) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &TaggedValue) -> bool
fn ne(&self, other: &TaggedValue) -> bool
This method tests for !=
.
sourceimpl PartialOrd<TaggedValue> for TaggedValue
impl PartialOrd<TaggedValue> for TaggedValue
sourcefn partial_cmp(&self, other: &TaggedValue) -> Option<Ordering>
fn partial_cmp(&self, other: &TaggedValue) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for TaggedValue
impl Serialize for TaggedValue
impl StructuralPartialEq for TaggedValue
Auto Trait Implementations
impl RefUnwindSafe for TaggedValue
impl Send for TaggedValue
impl Sync for TaggedValue
impl Unpin for TaggedValue
impl UnwindSafe for TaggedValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more