Type Alias ExpansionSpanMap

Source
pub type ExpansionSpanMap = SpanMap<SyntaxContext>;

Aliased Type§

struct ExpansionSpanMap {
    pub matched_arm: Option<u32>,
    /* private fields */
}

Fields§

§matched_arm: Option<u32>

Index of the matched macro arm on successful expansion for declarative macros.

Implementations

§

impl<S> SpanMap<S>
where SpanData<S>: Copy,

pub fn empty() -> SpanMap<S>

Creates a new empty [SpanMap].

pub fn finish(&mut self)

Finalizes the [SpanMap], shrinking its backing storage and validating that the offsets are in order.

pub fn push(&mut self, offset: TextSize, span: SpanData<S>)

Pushes a new span onto the [SpanMap].

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.

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.

pub fn span_at(&self, offset: TextSize) -> SpanData<S>

Returns the span at the given position.

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>)>

pub fn merge( &mut self, other_range: TextRange, other_size: TextSize, other: &SpanMap<S>, )

Merges this span map with another span map, where other is inserted at (and replaces) other_range.

The length of the replacement node needs to be other_size.

Trait Implementations

§

impl<S> Clone for SpanMap<S>
where S: Clone,

§

fn clone(&self) -> SpanMap<S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<S> Debug for SpanMap<S>
where S: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<S> Hash for SpanMap<S>
where S: Hash,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<S> PartialEq for SpanMap<S>
where S: PartialEq,

§

fn eq(&self, other: &SpanMap<S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<S> SpanMapper<SpanData<S>> for SpanMap<S>
where SpanData<S>: Copy,

§

fn span_for(&self, range: TextRange) -> SpanData<S>

§

impl<S> Eq for SpanMap<S>
where S: Eq,

§

impl<S> StructuralPartialEq for SpanMap<S>