Trait Span

Source
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§

Source

fn start_line(&self) -> usize

Source

fn end_line(&self) -> usize

Source

fn start_column(&self) -> usize

Source

fn end_column(&self) -> usize

Provided Methods§

Source

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
Source

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.

Implementations on Foreign Types§

Source§

impl Span for Span

Implementors§