pub struct Tree { /* private fields */ }Implementations§
Source§impl Tree
impl Tree
pub const ROOT: ElementId = 0
pub fn is_empty(&self) -> bool
pub fn kind(&self, e: ElementId) -> SyntaxKind
pub fn is_token(&self, e: ElementId) -> bool
Sourcepub fn subtree_end(&self, e: ElementId) -> ElementId
pub fn subtree_end(&self, e: ElementId) -> ElementId
One past the last element of e’s subtree, in preorder.
pub fn parent(&self, e: ElementId) -> Option<ElementId>
pub fn first_child(&self, e: ElementId) -> Option<ElementId>
pub fn last_child(&self, e: ElementId) -> Option<ElementId>
pub fn next_sibling(&self, e: ElementId) -> Option<ElementId>
pub fn prev_sibling(&self, e: ElementId) -> Option<ElementId>
pub fn children(&self, e: ElementId) -> Children<'_> ⓘ
pub fn text_range(&self, e: ElementId) -> TextRange
pub fn text_of(&self, e: ElementId) -> &str
Sourcepub fn has_descendant_of_kind(&self, e: ElementId, kind: SyntaxKind) -> bool
pub fn has_descendant_of_kind(&self, e: ElementId, kind: SyntaxKind) -> bool
Whether any element strictly inside e’s subtree has kind.
Sourcepub fn find_kinds<const N: usize, const M: usize>(
&self,
e: ElementId,
nodes: [SyntaxKind; N],
tokens: [SyntaxKind; M],
) -> KindScan<'_> ⓘ
pub fn find_kinds<const N: usize, const M: usize>( &self, e: ElementId, nodes: [SyntaxKind; N], tokens: [SyntaxKind; M], ) -> KindScan<'_> ⓘ
The elements of e’s subtree (e included), in preorder, that are nodes of one of nodes or
tokens of one of tokens: a scan of the raw kind words, cheaper than a kind/is_token walk.
Trait Implementations§
impl Eq for Tree
impl StructuralPartialEq for Tree
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
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