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: Copy> SpanMap<S>
impl<S: Copy> 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 ranges_with_span(&self, span: S) -> impl Iterator<Item = TextRange> + '_where
S: Eq,
pub fn ranges_with_span(&self, span: S) -> impl Iterator<Item = TextRange> + '_where
S: Eq,
Returns all TextRanges that correspond to 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 = S> + '_
pub fn spans_for_range(&self, range: TextRange) -> impl Iterator<Item = 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, 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> 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
§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.