pub struct TaggedNode(/* private fields */);Expand description
A YAML tagged scalar (tag + value)
Note: This type uses interior mutability through the rowan library.
Mutation methods work even when called through &self. See the crate-level
documentation for details on the mutability model.
Implementations§
Source§impl TaggedNode
impl TaggedNode
Sourcepub fn tag(&self) -> Option<String>
pub fn tag(&self) -> Option<String>
Get the tag part of this tagged scalar (e.g., “!custom” from “!custom value”)
Sourcepub fn value(&self) -> Option<Scalar>
pub fn value(&self) -> Option<Scalar>
Get the value part of this tagged scalar (without the tag)
Sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
Get the string value of this tagged scalar (just the value part), with quotes stripped and escape sequences processed.
Sourcepub fn as_set(&self) -> Option<Set>
pub fn as_set(&self) -> Option<Set>
Extract a set from this tagged scalar if it has a !!set tag
Sourcepub fn as_ordered_mapping(&self) -> Option<Vec<MappingEntry>>
pub fn as_ordered_mapping(&self) -> Option<Vec<MappingEntry>>
Extract ordered mapping from this tagged scalar if it has a !!omap tag.
Returns the entries of the inner sequence as MappingEntry values, each
holding a single key-value pair with full CST fidelity.
Sourcepub fn as_pairs(&self) -> Option<Vec<MappingEntry>>
pub fn as_pairs(&self) -> Option<Vec<MappingEntry>>
Extract pairs from this tagged scalar if it has a !!pairs tag.
Returns the entries of the inner sequence as MappingEntry values.
Unlike !!omap, duplicate keys are allowed.
Trait Implementations§
Source§impl AsYaml for TaggedNode
impl AsYaml for TaggedNode
Source§fn as_node(&self) -> Option<&SyntaxNode<Lang>>
fn as_node(&self) -> Option<&SyntaxNode<Lang>>
SyntaxNode if one exists. Read moreSource§fn build_content(
&self,
builder: &mut GreenNodeBuilder<'_>,
_indent: usize,
_flow_context: bool,
) -> bool
fn build_content( &self, builder: &mut GreenNodeBuilder<'_>, _indent: usize, _flow_context: bool, ) -> bool
GreenNodeBuilder. Read moreSource§impl AstNode for TaggedNode
impl AstNode for TaggedNode
Source§impl Clone for TaggedNode
impl Clone for TaggedNode
Source§fn clone(&self) -> TaggedNode
fn clone(&self) -> TaggedNode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more