pub struct NodeRef<'a> { /* private fields */ }Expand description
A node, borrowing from the frame it was parsed from.
Implementations§
Source§impl<'a> NodeRef<'a>
impl<'a> NodeRef<'a>
Sourcepub const fn attr_count(&self) -> usize
pub const fn attr_count(&self) -> usize
How many attributes the node carries.
Sourcepub const fn has_content(&self) -> bool
pub const fn has_content(&self) -> bool
Whether the node has a body.
Sourcepub fn attr(&self, key: &str) -> Option<Value<'a>>
pub fn attr(&self, key: &str) -> Option<Value<'a>>
The first value for key.
Attribute keys are tokens or short strings, so a linear scan over the handful a stanza carries beats building an index.
Sourcepub fn attr_eq(&self, key: &str, expected: &str) -> bool
pub fn attr_eq(&self, key: &str, expected: &str) -> bool
Whether an attribute equals expected — the comparison L1 derivation
leans on, done without allocating.
Sourcepub fn children(&self) -> Children<'a> ⓘ
pub fn children(&self) -> Children<'a> ⓘ
The child nodes, or an empty iterator when the body is not a list.
Sourcepub fn at_path<I>(&self, path: I) -> Option<NodeRef<'a>>where
I: IntoIterator<Item = u16>,
pub fn at_path<I>(&self, path: I) -> Option<NodeRef<'a>>where
I: IntoIterator<Item = u16>,
Follow a path of child indices from this node.
This is how an envelope’s plaintext entries find the node they belong
to: the path in a PlaintextEntry addresses exactly this walk.
Trait Implementations§
impl<'a> Copy for NodeRef<'a>
impl<'a> Eq for NodeRef<'a>
impl<'a> StructuralPartialEq for NodeRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for NodeRef<'a>
impl<'a> RefUnwindSafe for NodeRef<'a>
impl<'a> Send for NodeRef<'a>
impl<'a> Sync for NodeRef<'a>
impl<'a> Unpin for NodeRef<'a>
impl<'a> UnsafeUnpin for NodeRef<'a>
impl<'a> UnwindSafe for NodeRef<'a>
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