pub enum Program<'a> {
Module(&'a Module<'a>),
Script(&'a Script<'a>),
}
Expand description
A Module or Script node.
Variants§
Trait Implementations§
source§impl<'a> NodeTrait<'a> for Program<'a>
impl<'a> NodeTrait<'a> for Program<'a>
fn parent(&self) -> Option<Node<'a>>
fn children(&self) -> Vec<Node<'a>>
fn as_node(&self) -> Node<'a>
fn kind(&self) -> NodeKind
fn ancestors(&self) -> AncestorIterator<'a>
fn start_line(&self) -> usize
fn end_line(&self) -> usize
fn start_column(&self) -> usize
fn end_column(&self) -> usize
fn char_width(&self) -> usize
fn child_index(&self) -> usize
fn previous_sibling(&self) -> Option<Node<'a>>
source§fn previous_siblings(&self) -> Vec<Node<'a>>
fn previous_siblings(&self) -> Vec<Node<'a>>
Gets the previous siblings in the order they appear in the file.
source§fn next_sibling(&self) -> Option<Node<'a>>
fn next_sibling(&self) -> Option<Node<'a>>
Gets the next siblings in the order they appear in the file.
fn next_siblings(&self) -> Vec<Node<'a>>
fn tokens(&self) -> &'a [TokenAndSpan]
fn children_with_tokens(&self) -> Vec<NodeOrToken<'a>>
fn children_with_tokens_fast( &self, program: impl RootNode<'a> ) -> Vec<NodeOrToken<'a>>
fn leading_comments(&self) -> CommentsIterator<'a>
fn trailing_comments(&self) -> CommentsIterator<'a>
source§fn module(&self) -> &Module<'a>
fn module(&self) -> &Module<'a>
Gets the root node if the view was created from a Module; otherwise panics.
source§fn script(&self) -> &Script<'a>
fn script(&self) -> &Script<'a>
Gets the root node if the view was created from a Script; otherwise panics.
fn text(&self) -> &'a str
fn previous_token(&self) -> Option<&'a TokenAndSpan>
fn next_token(&self) -> Option<&'a TokenAndSpan>
source§fn previous_tokens(&self) -> &'a [TokenAndSpan]
fn previous_tokens(&self) -> &'a [TokenAndSpan]
Gets the previous tokens in the order they appear in the file.
source§fn next_tokens(&self) -> &'a [TokenAndSpan]
fn next_tokens(&self) -> &'a [TokenAndSpan]
Gets the next tokens in the order they appear in the file.
source§impl<'a> RootNode<'a> for Program<'a>
impl<'a> RootNode<'a> for Program<'a>
fn maybe_text_info(&self) -> Option<&'a SourceTextInfo>
fn maybe_token_container(&self) -> Option<&'a TokenContainer<'a>>
fn maybe_comment_container(&self) -> Option<&'a CommentContainer<'a>>
fn token_at_index(&self, index: usize) -> Option<&'a TokenAndSpan>
fn token_container(&self) -> &'a TokenContainer<'a>
fn comment_container(&self) -> &'a CommentContainer<'a>
source§impl<'a> SourceRanged for Program<'a>
impl<'a> SourceRanged for Program<'a>
fn start(&self) -> SourcePos
fn end(&self) -> SourcePos
fn range(&self) -> SourceRange
fn byte_width(&self) -> usize
fn start_line_fast<'a, P>(&self, source: P) -> usizewhere
P: SourceTextInfoProvider<'a>,
fn end_line_fast<'a, P>(&self, source: P) -> usizewhere
P: SourceTextInfoProvider<'a>,
fn start_column_fast<'a, P>(&self, source: P) -> usizewhere
P: SourceTextInfoProvider<'a>,
fn end_column_fast<'a, P>(&self, source: P) -> usizewhere
P: SourceTextInfoProvider<'a>,
fn column_at_pos<'a, P>(&self, source: P, pos: SourcePos) -> usizewhere
P: SourceTextInfoProvider<'a>,
fn char_width_fast<'a, P>(&self, source: P) -> usizewhere
P: SourceTextInfoProvider<'a>,
fn text_fast<'a, P>(&self, source: P) -> &'a strwhere
P: SourceTextInfoProvider<'a>,
fn tokens_fast<'a>(&self, program: impl RootNode<'a>) -> &'a [TokenAndSpan]
fn leading_comments_fast<'a>( &self, program: impl RootNode<'a> ) -> CommentsIterator<'a>
fn trailing_comments_fast<'a>( &self, program: impl RootNode<'a> ) -> CommentsIterator<'a>
fn previous_token_fast<'a>( &self, program: impl RootNode<'a> ) -> Option<&'a TokenAndSpan>
fn next_token_fast<'a>( &self, program: impl RootNode<'a> ) -> Option<&'a TokenAndSpan>
fn previous_tokens_fast<'a>( &self, program: impl RootNode<'a> ) -> &'a [TokenAndSpan]
fn next_tokens_fast<'a>(&self, program: impl RootNode<'a>) -> &'a [TokenAndSpan]
impl<'a> Copy for Program<'a>
Auto Trait Implementations§
impl<'a> Freeze for Program<'a>
impl<'a> !RefUnwindSafe for Program<'a>
impl<'a> !Send for Program<'a>
impl<'a> !Sync for Program<'a>
impl<'a> Unpin for Program<'a>
impl<'a> !UnwindSafe for Program<'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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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