Struct proc_macro2::Span
source · pub struct Span { /* private fields */ }
Expand description
A region of source code, along with macro expansion information.
Implementations
sourceimpl Span
impl Span
sourcepub fn call_site() -> Span
pub fn call_site() -> Span
The span of the invocation of the current procedural macro.
Identifiers created with this span will be resolved as if they were written directly at the macro call location (call-site hygiene) and other code at the macro call site will be able to refer to them as well.
sourcepub fn def_site() -> Span
pub fn def_site() -> Span
A span that resolves at the macro definition site.
This method is semver exempt and not exposed by default.
sourcepub fn resolved_at(&self, other: Span) -> Span
pub fn resolved_at(&self, other: Span) -> Span
Creates a new span with the same line/column information as self
but
that resolves symbols as though it were at other
.
This method is semver exempt and not exposed by default.
sourcepub fn located_at(&self, other: Span) -> Span
pub fn located_at(&self, other: Span) -> Span
Creates a new span with the same name resolution behavior as self
but
with the line/column information of other
.
This method is semver exempt and not exposed by default.
sourcepub fn source_file(&self) -> SourceFile
pub fn source_file(&self) -> SourceFile
The original source file into which this span points.
This method is semver exempt and not exposed by default.
sourcepub fn start(&self) -> LineColumn
pub fn start(&self) -> LineColumn
Get the starting line/column in the source file for this span.
This method is semver exempt and not exposed by default.
sourcepub fn end(&self) -> LineColumn
pub fn end(&self) -> LineColumn
Get the ending line/column in the source file for this span.
This method is semver exempt and not exposed by default.