Struct proc_macro_error::SpanRange
source · [−]Fields
first: Span
last: Span
Implementations
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more