pub struct Value<'a> { /* private fields */ }Expand description
One value in a tree.
Implementations§
Source§impl<'a> Value<'a>
impl<'a> Value<'a>
Sourcepub fn tag(&self) -> Option<&'a Tag>
pub fn tag(&self) -> Option<&'a Tag>
The value’s YAML tag, which in ASDF is what gives it its type.
Sourcepub fn has_tag(&self, name: &str) -> bool
pub fn has_tag(&self, name: &str) -> bool
Whether the tag names this ASDF schema, ignoring its version.
So has_tag("core/ndarray") matches both core/ndarray-1.0.0 and
core/ndarray-1.1.0.
Sourcepub fn as_raw_str(&self) -> Option<&'a str>
pub fn as_raw_str(&self) -> Option<&'a str>
The raw scalar text, whatever its type.
Sourcepub fn as_str(&self) -> Option<&'a str>
pub fn as_str(&self) -> Option<&'a str>
The value as a string, if it is one.
A quoted "42" is a string; an unquoted 42 is not.
Sourcepub fn is_mapping(&self) -> bool
pub fn is_mapping(&self) -> bool
Whether this is a mapping.
Sourcepub fn is_sequence(&self) -> bool
pub fn is_sequence(&self) -> bool
Whether this is a sequence.
Sourcepub fn at(&self, index: i64) -> Option<Value<'a>>
pub fn at(&self, index: i64) -> Option<Value<'a>>
A sequence element, with negative indices counting from the end.
Sourcepub fn entries(&self) -> impl Iterator<Item = (&'a str, Value<'a>)> + 'a
pub fn entries(&self) -> impl Iterator<Item = (&'a str, Value<'a>)> + 'a
Iterate a mapping’s entries in document order.
Sourcepub fn as_ndarray(&self) -> Option<Ndarray>
pub fn as_ndarray(&self) -> Option<Ndarray>
Interpret this value as an ndarray.
Returns None when it is not one; the array’s data is then read
through AsdfFile::read_array.
Sourcepub fn as_software(&self) -> Option<Software>
pub fn as_software(&self) -> Option<Software>
Interpret this value as a core/software record.
Sourcepub fn as_history_entry(&self) -> Option<HistoryEntry>
pub fn as_history_entry(&self) -> Option<HistoryEntry>
Interpret this value as a core/history_entry record.
Sourcepub fn as_extension_metadata(&self) -> Option<ExtensionMetadata>
pub fn as_extension_metadata(&self) -> Option<ExtensionMetadata>
Interpret this value as a core/extension_metadata record.