HasSpan

Trait HasSpan 

Source
pub trait HasSpan {
    // Required method
    fn span(&self) -> Span;

    // Provided methods
    fn start_position(&self) -> Position { ... }
    fn start_offset(&self) -> u32 { ... }
    fn end_position(&self) -> Position { ... }
    fn end_offset(&self) -> u32 { ... }
}
Expand description

A trait for types that cover a span of source code.

Required Methods§

Source

fn span(&self) -> Span

Returns the source span.

Provided Methods§

Source

fn start_position(&self) -> Position

A convenience method to get the starting position of the span.

Source

fn start_offset(&self) -> u32

A convenience method to get the starting byte offset of the span.

Source

fn end_position(&self) -> Position

A convenience method to get the ending position of the span.

Source

fn end_offset(&self) -> u32

A convenience method to get the ending byte offset of the span.

Implementations on Foreign Types§

Source§

impl<T: HasSpan> HasSpan for &T

Ergonomic blanket impl for references.

Source§

fn span(&self) -> Span

Source§

impl<T: HasSpan> HasSpan for Box<T>

Ergonomic blanket impl for boxed values.

Source§

fn span(&self) -> Span

Implementors§