Struct ra_ap_span::SpanMap
source · pub struct SpanMap<S> { /* private fields */ }Expand description
Maps absolute text ranges for the corresponding file to the relevant span data.
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> + '_where
S: Copy,
pub fn ranges_with_span_exact(
&self,
span: SpanData<S>
) -> impl Iterator<Item = TextRange> + '_where
S: Copy,
Returns all TextRanges 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> + '_where
S: Copy,
pub fn ranges_with_span(
&self,
span: SpanData<S>
) -> impl Iterator<Item = TextRange> + '_where
S: Copy,
Returns all TextRanges 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§
source§impl<S: PartialEq> PartialEq for SpanMap<S>
impl<S: PartialEq> PartialEq for SpanMap<S>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<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.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