Struct deno_ast::SourceRange
source · pub struct SourceRange<T = SourcePos>{
pub start: T,
pub end: SourcePos,
}
Fields§
§start: T
§end: SourcePos
Implementations§
source§impl<T> SourceRange<T>
impl<T> SourceRange<T>
source§impl SourceRange
impl SourceRange
sourcepub fn as_byte_range(&self, source_start: StartSourcePos) -> Range<usize>
pub fn as_byte_range(&self, source_start: StartSourcePos) -> Range<usize>
Gets the relative byte range based on the source text’s start position.
sourcepub fn unsafely_from_span(span: Span) -> SourceRange
pub fn unsafely_from_span(span: Span) -> SourceRange
Do not use this except when receiving an swc span
from swc and needing to convert it to a source position.
Generally, prefer using the .range()
method.
source§impl SourceRange<StartSourcePos>
impl SourceRange<StartSourcePos>
sourcepub fn as_byte_range(&self) -> Range<usize>
pub fn as_byte_range(&self) -> Range<usize>
Gets the relative byte range based on the source text’s start position.
Trait Implementations§
source§impl<T> Clone for SourceRange<T>
impl<T> Clone for SourceRange<T>
source§fn clone(&self) -> SourceRange<T>
fn clone(&self) -> SourceRange<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> Debug for SourceRange<T>
impl<T> Debug for SourceRange<T>
source§impl<T> Hash for SourceRange<T>
impl<T> Hash for SourceRange<T>
source§impl Into<Span> for SourceRange
impl Into<Span> for SourceRange
source§impl<T> Ord for SourceRange<T>
impl<T> Ord for SourceRange<T>
source§fn cmp(&self, other: &SourceRange<T>) -> Ordering
fn cmp(&self, other: &SourceRange<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T> PartialEq for SourceRange<T>
impl<T> PartialEq for SourceRange<T>
source§fn eq(&self, other: &SourceRange<T>) -> bool
fn eq(&self, other: &SourceRange<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T> PartialOrd for SourceRange<T>
impl<T> PartialOrd for SourceRange<T>
source§fn partial_cmp(&self, other: &SourceRange<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &SourceRange<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T> SourceRanged for SourceRange<T>
impl<T> SourceRanged for SourceRange<T>
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<T> Copy for SourceRange<T>
impl<T> Eq for SourceRange<T>
impl<T> StructuralEq for SourceRange<T>
impl<T> StructuralPartialEq for SourceRange<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for SourceRange<T>where
T: RefUnwindSafe,
impl<T> Send for SourceRange<T>where
T: Send,
impl<T> Sync for SourceRange<T>where
T: Sync,
impl<T> Unpin for SourceRange<T>where
T: Unpin,
impl<T> UnwindSafe for SourceRange<T>where
T: UnwindSafe,
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.