Trait deno_ast::SourceRangedForSpanned
source · pub trait SourceRangedForSpanned {
Show 18 methods
// Required methods
fn start(&self) -> SourcePos;
fn end(&self) -> SourcePos;
// Provided methods
fn range(&self) -> SourceRange { ... }
fn byte_width(&self) -> usize { ... }
fn start_line_fast<'a, P>(&self, source: P) -> usize
where P: SourceTextInfoProvider<'a> { ... }
fn end_line_fast<'a, P>(&self, source: P) -> usize
where P: SourceTextInfoProvider<'a> { ... }
fn start_column_fast<'a, P>(&self, source: P) -> usize
where P: SourceTextInfoProvider<'a> { ... }
fn end_column_fast<'a, P>(&self, source: P) -> usize
where P: SourceTextInfoProvider<'a> { ... }
fn column_at_pos<'a, P>(&self, source: P, pos: SourcePos) -> usize
where P: SourceTextInfoProvider<'a> { ... }
fn char_width_fast<'a, P>(&self, source: P) -> usize
where P: SourceTextInfoProvider<'a> { ... }
fn text_fast<'a, P>(&self, source: P) -> &'a str
where 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] { ... }
}
Expand description
Adds source position helper methods for swc types that implement
swc_common::Spanned
.
There were conflicts with implementing SourceRanged
for &SourceRanged
with swc’s Spanned implementation, so this needed to be a separate trait
unfortunately and I couldn’t figure out how to combine it with SourceRanged
Required Methods§
Provided Methods§
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]
Object Safety§
This trait is not object safe.