pub struct SpanMap<S> {
pub matched_arm: Option<u32>,
/* private fields */
}
Expand description
Maps absolute text ranges for the corresponding file to the relevant span data.
Fields§
§matched_arm: Option<u32>
Index of the matched macro arm on successful expansion for declarative macros.
Implementations§
source§impl<S> SpanMap<S>
impl<S> SpanMap<S>
sourcepub fn finish(&mut self)
pub fn finish(&mut self)
Finalizes the SpanMap
, shrinking its backing storage and validating that the offsets are
in order.
sourcepub fn push(&mut self, offset: TextSize, span: SpanData<S>)
pub fn push(&mut self, offset: TextSize, span: SpanData<S>)
Pushes a new span onto the SpanMap
.
sourcepub fn ranges_with_span_exact(
&self,
span: SpanData<S>,
) -> impl Iterator<Item = (TextRange, S)> + '_where
S: Copy,
pub fn ranges_with_span_exact(
&self,
span: SpanData<S>,
) -> impl Iterator<Item = (TextRange, S)> + '_where
S: Copy,
Returns all TextRange
s that correspond to the given span.
Note this does a linear search through the entire backing vector.
sourcepub fn ranges_with_span(
&self,
span: SpanData<S>,
) -> impl Iterator<Item = (TextRange, S)> + '_where
S: Copy,
pub fn ranges_with_span(
&self,
span: SpanData<S>,
) -> impl Iterator<Item = (TextRange, S)> + '_where
S: Copy,
Returns all TextRange
s whose spans contain the given span.
Note this does a linear search through the entire backing vector.
sourcepub fn spans_for_range(
&self,
range: TextRange,
) -> impl Iterator<Item = SpanData<S>> + '_
pub fn spans_for_range( &self, range: TextRange, ) -> impl Iterator<Item = SpanData<S>> + '_
Returns the spans associated with the given range. In other words, this will return all spans that correspond to all offsets within the given range.
pub fn iter(&self) -> impl Iterator<Item = (TextSize, SpanData<S>)> + '_
Trait Implementations§
impl<S: Eq> Eq for SpanMap<S>
impl<S> StructuralPartialEq for SpanMap<S>
Auto Trait Implementations§
impl<S> Freeze for SpanMap<S>
impl<S> RefUnwindSafe for SpanMap<S>where
S: RefUnwindSafe,
impl<S> Send for SpanMap<S>where
S: Send,
impl<S> Sync for SpanMap<S>where
S: Sync,
impl<S> Unpin for SpanMap<S>where
S: Unpin,
impl<S> UnwindSafe for SpanMap<S>where
S: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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