pub struct NodeRef<'a> { /* private fields */ }Expand description
Read-only borrowed handle to a node within a Document.
Implementations§
Source§impl<'a> NodeRef<'a>
impl<'a> NodeRef<'a>
Sourcepub fn is_command(&self, name: &str) -> bool
pub fn is_command(&self, name: &str) -> bool
true when this is a command named name.
Sourcepub fn parent(&self) -> Option<NodeRef<'a>>
pub fn parent(&self) -> Option<NodeRef<'a>>
Parent handle, or None for the root / a detached node.
Sourcepub fn children(&self) -> impl Iterator<Item = NodeRef<'a>> + 'a
pub fn children(&self) -> impl Iterator<Item = NodeRef<'a>> + 'a
Direct children (root/group only; other kinds yield an empty iterator).
Sourcepub fn next_sibling(&self) -> Option<NodeRef<'a>>
pub fn next_sibling(&self) -> Option<NodeRef<'a>>
Next sibling when attached as a group child.
Sourcepub fn prev_sibling(&self) -> Option<NodeRef<'a>>
pub fn prev_sibling(&self) -> Option<NodeRef<'a>>
Previous sibling when attached as a group child.
Sourcepub fn ancestors(&self) -> impl Iterator<Item = NodeRef<'a>> + 'a
pub fn ancestors(&self) -> impl Iterator<Item = NodeRef<'a>> + 'a
Ancestors from immediate parent up to the root.
Sourcepub fn descendants(&self) -> impl Iterator<Item = NodeRef<'a>> + 'a
pub fn descendants(&self) -> impl Iterator<Item = NodeRef<'a>> + 'a
All descendants in depth-first order, excluding self.
Sourcepub fn command_name(&self) -> Option<&'a str>
pub fn command_name(&self) -> Option<&'a str>
Command/infix/declarative name without leading backslash.
Sourcepub fn prime_count(&self) -> Option<usize>
pub fn prime_count(&self) -> Option<usize>
Prime mark count for a Prime node.
Sourcepub fn error_parts(&self) -> Option<(&'a str, &'a str)>
pub fn error_parts(&self) -> Option<(&'a str, &'a str)>
Error message + snippet for an Error node.
Sourcepub fn content_mode(&self) -> Option<ContentMode>
pub fn content_mode(&self) -> Option<ContentMode>
Content mode for root/group nodes.
Sourcepub fn group_kind(&self) -> Option<GroupKindRef<'a>>
pub fn group_kind(&self) -> Option<GroupKindRef<'a>>
Group kind for group nodes.
Sourcepub fn script_base(&self) -> Option<NodeRef<'a>>
pub fn script_base(&self) -> Option<NodeRef<'a>>
Scripted base.
Sourcepub fn superscript(&self) -> Option<NodeRef<'a>>
pub fn superscript(&self) -> Option<NodeRef<'a>>
Scripted superscript.
Sourcepub fn infix_left(&self) -> Option<NodeRef<'a>>
pub fn infix_left(&self) -> Option<NodeRef<'a>>
Infix left operand.
Sourcepub fn infix_right(&self) -> Option<NodeRef<'a>>
pub fn infix_right(&self) -> Option<NodeRef<'a>>
Infix right operand.
Trait Implementations§
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