Struct proc_macro_error2::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
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpanRange
impl RefUnwindSafe for SpanRange
impl !Send for SpanRange
impl !Sync for SpanRange
impl Unpin for SpanRange
impl UnwindSafe for SpanRange
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)