pub trait Span {
// Required methods
fn start_line(&self) -> usize;
fn end_line(&self) -> usize;
fn start_column(&self) -> usize;
fn end_column(&self) -> usize;
// Provided methods
fn to_range(&self) -> String { ... }
fn debug(&self, code: &str) -> String { ... }
}
Expand description
A trait for types that represent a span in the source code.
This trait is implemented for proc_macro2::Span
Required Methods§
fn start_line(&self) -> usize
fn end_line(&self) -> usize
fn start_column(&self) -> usize
fn end_column(&self) -> usize
Provided Methods§
Sourcefn to_range(&self) -> String
fn to_range(&self) -> String
Returns a string representation of the span in the format start_line:start_column..end_line:end_column
§Example
1:7..1:10
Sourcefn debug(&self, code: &str) -> String
fn debug(&self, code: &str) -> String
Generate a debug representation of the span and the source code it points to.
see debug_span
for more information.