Struct proc_macro_error::SpanRange
source · pub struct SpanRange {
pub first: Span,
pub last: Span,
}
Fields§
§first: Span
§last: Span
Implementations§
source§impl SpanRange
impl SpanRange
sourcepub fn single_span(span: Span) -> Self
pub fn single_span(span: Span) -> Self
Create a range with the first
and last
spans being the same.
sourcepub fn from_tokens(ts: &dyn ToTokens) -> Self
pub fn from_tokens(ts: &dyn ToTokens) -> Self
Construct span range from a TokenStream
. This method always preserves all the
range.
Note
If the stream is empty, the result is SpanRange::call_site()
. If the stream
consists of only one TokenTree
, the result is SpanRange::single_span(tt.span())
that doesn’t lose anything.
sourcepub fn join_range(self, other: SpanRange) -> Self
pub fn join_range(self, other: SpanRange) -> Self
Join two span ranges. The resulting range will start at self.first
and end at
other.last
.