pub struct Node {
pub kind: String,
pub text: String,
pub start_byte: usize,
pub end_byte: usize,
pub children: Vec<Node>,
}Expand description
A node in the bash AST.
Fields§
§kind: String§text: String§start_byte: usize§end_byte: usize§children: Vec<Node>Implementations§
Source§impl Node
impl Node
Sourcepub fn child(&self, kind: &str) -> Option<&Node>
pub fn child(&self, kind: &str) -> Option<&Node>
Find the first direct child with the given kind.
Sourcepub fn children_of_kind(&self, kinds: &[&str]) -> impl Iterator<Item = &Node>
pub fn children_of_kind(&self, kinds: &[&str]) -> impl Iterator<Item = &Node>
Iterate over direct children of the given kinds.
Sourcepub fn find_descendant(&self, kind: &str) -> Option<&Node>
pub fn find_descendant(&self, kind: &str) -> Option<&Node>
Find the first descendant (depth-first) with the given kind.
Sourcepub fn has_descendant(&self, kind: &str) -> bool
pub fn has_descendant(&self, kind: &str) -> bool
True if any descendant has the given kind.
Sourcepub fn collect_descendants<'a>(&'a self, kind: &str, out: &mut Vec<&'a Node>)
pub fn collect_descendants<'a>(&'a self, kind: &str, out: &mut Vec<&'a Node>)
Collect every descendant of the given kind.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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