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,
impl<S> SpanMap<S>where
SpanData<S>: Copy,
pub fn empty() -> SpanMap<S>
pub fn empty() -> SpanMap<S>
Creates a new empty [SpanMap
].
pub fn finish(&mut self)
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>)
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,
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,
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>
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>>
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>,
)
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
.