pub struct CallbackDeclaration(/* private fields */);
Implementations§
Source§impl CallbackDeclaration
impl CallbackDeclaration
pub fn DeclaredIdentifier(&self) -> DeclaredIdentifier
pub fn Type(&self) -> impl Iterator<Item = Type>
pub fn ReturnType(&self) -> Option<ReturnType>
pub fn TwoWayBinding(&self) -> Option<TwoWayBinding>
Sourcepub fn new(node: SyntaxNode) -> Option<Self>
pub fn new(node: SyntaxNode) -> Option<Self>
Create a new node from a SyntaxNode, if the SyntaxNode is of the correct kind
Methods from Deref<Target = SyntaxNode>§
pub fn child_node(&self, kind: SyntaxKind) -> Option<SyntaxNode>
pub fn child_token(&self, kind: SyntaxKind) -> Option<SyntaxToken>
pub fn child_text(&self, kind: SyntaxKind) -> Option<String>
pub fn kind(&self) -> SyntaxKind
pub fn children(&self) -> impl Iterator<Item = SyntaxNode>
pub fn children_with_tokens(&self) -> impl Iterator<Item = NodeOrToken>
pub fn text(&self) -> SyntaxText
pub fn parent(&self) -> Option<SyntaxNode>
Methods from Deref<Target = SyntaxNode<Language>>§
Sourcepub fn replace_with(&self, replacement: GreenNode) -> GreenNode
pub fn replace_with(&self, replacement: GreenNode) -> GreenNode
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
pub fn kind(&self) -> <L as Language>::Kind
pub fn text_range(&self) -> TextRange
pub fn index(&self) -> usize
pub fn text(&self) -> SyntaxText
pub fn green(&self) -> Cow<'_, GreenNodeData>
pub fn parent(&self) -> Option<SyntaxNode<L>>
pub fn ancestors(&self) -> impl Iterator<Item = SyntaxNode<L>>
pub fn children(&self) -> SyntaxNodeChildren<L>
pub fn children_with_tokens(&self) -> SyntaxElementChildren<L>
pub fn first_child(&self) -> Option<SyntaxNode<L>>
pub fn last_child(&self) -> Option<SyntaxNode<L>>
pub fn first_child_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn last_child_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn next_sibling(&self) -> Option<SyntaxNode<L>>
pub fn prev_sibling(&self) -> Option<SyntaxNode<L>>
pub fn next_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn prev_sibling_or_token( &self, ) -> Option<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
Sourcepub fn first_token(&self) -> Option<SyntaxToken<L>>
pub fn first_token(&self) -> Option<SyntaxToken<L>>
Return the leftmost token in the subtree of this node.
Sourcepub fn last_token(&self) -> Option<SyntaxToken<L>>
pub fn last_token(&self) -> Option<SyntaxToken<L>>
Return the rightmost token in the subtree of this node.
pub fn siblings( &self, direction: Direction, ) -> impl Iterator<Item = SyntaxNode<L>>
pub fn siblings_with_tokens( &self, direction: Direction, ) -> impl Iterator<Item = NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
pub fn descendants(&self) -> impl Iterator<Item = SyntaxNode<L>>
pub fn descendants_with_tokens( &self, ) -> impl Iterator<Item = NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>
Sourcepub fn preorder(&self) -> Preorder<L>
pub fn preorder(&self) -> Preorder<L>
Traverse the subtree rooted at the current node (including the current node) in preorder, excluding tokens.
Sourcepub fn preorder_with_tokens(&self) -> PreorderWithTokens<L>
pub fn preorder_with_tokens(&self) -> PreorderWithTokens<L>
Traverse the subtree rooted at the current node (including the current node) in preorder, including tokens.
Sourcepub fn token_at_offset(&self, offset: TextSize) -> TokenAtOffset<SyntaxToken<L>>
pub fn token_at_offset(&self, offset: TextSize) -> TokenAtOffset<SyntaxToken<L>>
Find a token in the subtree corresponding to this node, which covers the offset. Precondition: offset must be withing node’s range.
Sourcepub 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
Sourcepub 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()
.
Sourcepub fn clone_subtree(&self) -> SyntaxNode<L>
pub fn clone_subtree(&self) -> SyntaxNode<L>
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 clone_for_update(&self) -> SyntaxNode<L>
pub fn detach(&self)
pub fn splice_children( &self, to_delete: Range<usize>, to_insert: Vec<NodeOrToken<SyntaxNode<L>, SyntaxToken<L>>>, )
Trait Implementations§
Source§impl Clone for CallbackDeclaration
impl Clone for CallbackDeclaration
Source§fn clone(&self) -> CallbackDeclaration
fn clone(&self) -> CallbackDeclaration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CallbackDeclaration
impl Debug for CallbackDeclaration
Source§impl Deref for CallbackDeclaration
impl Deref for CallbackDeclaration
Source§impl From<CallbackDeclaration> for SyntaxNode
impl From<CallbackDeclaration> for SyntaxNode
Source§fn from(original: CallbackDeclaration) -> Self
fn from(original: CallbackDeclaration) -> Self
Source§impl From<SyntaxNode> for CallbackDeclaration
impl From<SyntaxNode> for CallbackDeclaration
Source§fn from(node: SyntaxNode) -> Self
fn from(node: SyntaxNode) -> Self
Source§impl Spanned for CallbackDeclaration
impl Spanned for CallbackDeclaration
fn span(&self) -> Span
fn source_file(&self) -> Option<&SourceFile>
fn to_source_location(&self) -> SourceLocation
Auto Trait Implementations§
impl Freeze for CallbackDeclaration
impl !RefUnwindSafe for CallbackDeclaration
impl !Send for CallbackDeclaration
impl !Sync for CallbackDeclaration
impl Unpin for CallbackDeclaration
impl !UnwindSafe for CallbackDeclaration
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more