Struct sixtyfps_compilerlib::parser::syntax_nodes::Binding
source · [−]pub struct Binding(_);
Implementations
Create a new node from a SyntaxNode, if the SyntaxNode is of the correct kind
Methods from Deref<Target = SyntaxNode>
Methods from Deref<Target = SyntaxNode<Language>>
Returns a green tree, equal to the green tree this node belongs two, except with this node substitute. The complexity of operation is proportional to the depth of the tree
Return the leftmost token in the subtree of this node.
Return the rightmost token in the subtree of this node.
pub fn siblings_with_tokens(
&self,
direction: Direction
) -> impl Iterator<Item = NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn descendants_with_tokens(
&self
) -> impl Iterator<Item = NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
Traverse the subtree rooted at the current node (including the current node) in preorder, excluding tokens.
Traverse the subtree rooted at the current node (including the current node) in preorder, including tokens.
Find a token in the subtree corresponding to this node, which covers the offset. Precondition: offset must be withing node’s range.
pub fn covering_element(
&self,
range: TextRange
) -> NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>
pub fn covering_element(
&self,
range: TextRange
) -> NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>
Return the deepest node or token in the current subtree that fully contains the range. If the range is empty and is contained in two leaf nodes, either one can be returned. Precondition: range must be contained withing the current node
pub fn child_or_token_at_range(
&self,
range: TextRange
) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn child_or_token_at_range(
&self,
range: TextRange
) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
Finds a SyntaxElement
which intersects with a given range
. If
there are several intersecting elements, any one can be returned.
The method uses binary search internally, so it’s complexity is
O(log(N))
where N = self.children_with_tokens().count()
.
Returns an independent copy of the subtree rooted at this node.
The parent of the returned node will be None
, the start offset will be
zero, but, otherwise, it’ll be equivalent to the source node.
pub fn splice_children(
&self,
to_delete: Range<usize>,
to_insert: Vec<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>, Global>
)
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Binding
impl !UnwindSafe for Binding
Blanket Implementations
Mutably borrows from an owned value. Read more