Trait proclet::Span

source ·
pub trait Span: ProcMacro<Span = Self> + Copy {
    // Required methods
    fn call_site() -> Self;
    fn mixed_site() -> Self;
    fn resolved_at(&self, other: Self) -> Self;
    fn located_at(&self, other: Self) -> Self;
    fn source_text(&self) -> Option<String>;
}
Expand description

Span API trait. See proc_macro::Span.

This trait is implemented for Span in proc_macro and proc_macro2 if the corresponding feature is enabled.

See also SpanExt.

Required Methods§

source

fn call_site() -> Self

Create a new Span with call site hygiene.

source

fn mixed_site() -> Self

Create a new Span with mixed site hygiene.

source

fn resolved_at(&self, other: Self) -> Self

Create a new Span with the same position as self but that resolves as if it was other.

source

fn located_at(&self, other: Self) -> Self

Create a new Span that resolves like self but with the position of other.

source

fn source_text(&self) -> Option<String>

Get the source text of the span, if any. Observable behaviour should not rely on this.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Span for Span

Available on crate feature proc-macro only.
source§

fn call_site() -> Self

source§

fn mixed_site() -> Self

source§

fn resolved_at(&self, other: Self) -> Self

source§

fn located_at(&self, other: Self) -> Self

source§

fn source_text(&self) -> Option<String>

source§

impl Span for Span

Available on crate feature proc-macro2 only.
source§

fn call_site() -> Self

source§

fn mixed_site() -> Self

source§

fn resolved_at(&self, other: Self) -> Self

source§

fn located_at(&self, other: Self) -> Self

source§

fn source_text(&self) -> Option<String>

Implementors§