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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so 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.