Struct proc_macro_error::SpanRange
source · [−]Fields
first: Spanlast: SpanImplementations
sourceimpl 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 RefUnwindSafe for SpanRange
impl !Send for SpanRange
impl !Sync for SpanRange
impl Unpin for SpanRange
impl UnwindSafe for SpanRange
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more