[][src]Struct proc_macro_error::SpanRange

pub struct SpanRange {
    pub first: Span,
    pub last: Span,
}

Fields

first: Spanlast: Span

Implementations

impl SpanRange[src]

pub fn single_span(span: Span) -> Self[src]

Create a range with the first and last spans being the same.

pub fn call_site() -> Self[src]

Create a SpanRange resolving at call site.

pub fn from_tokens(ts: &dyn ToTokens) -> Self[src]

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.

pub fn join_range(self, other: SpanRange) -> Self[src]

Join two span ranges. The resulting range will start at self.first and end at other.last.

pub fn collapse(self) -> Span[src]

Collapse the range into single span, preserving as much information as possible.

Trait Implementations

impl Clone for SpanRange[src]

impl Copy for SpanRange[src]

impl Debug for SpanRange[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.