HasPosition

Trait HasPosition 

Source
pub trait HasPosition {
    // Required method
    fn position(&self) -> Position;

    // Provided method
    fn offset(&self) -> u32 { ... }
}
Expand description

A trait for types that have a single, defined source position.

Required Methods§

Source

fn position(&self) -> Position

Returns the source position.

Provided Methods§

Source

fn offset(&self) -> u32

A convenience method to get the byte offset of the position.

Implementors§

Source§

impl HasPosition for Position

Source§

impl<T: HasSpan> HasPosition for T

A blanket implementation that allows any HasSpan type to also be treated as a HasPosition type, using the span’s start as its position.