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§
sourcefn mixed_site() -> Self
fn mixed_site() -> Self
Create a new Span
with mixed site hygiene.
sourcefn resolved_at(&self, other: Self) -> Self
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
.
sourcefn located_at(&self, other: Self) -> Self
fn located_at(&self, other: Self) -> Self
Create a new Span
that resolves like self
but with the position of other
.
sourcefn source_text(&self) -> Option<String>
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.
impl Span for Span
Available on crate feature
proc-macro
only.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>
source§impl Span for Span
Available on crate feature proc-macro2
only.
impl Span for Span
Available on crate feature
proc-macro2
only.