Indexer

Trait Indexer 

Source
pub trait Indexer {
    // Required methods
    fn line_col_at(&self, pos: usize) -> (usize, usize);
    fn line_span_at(&self, pos: usize) -> (usize, usize);
    fn span_with_context_lines(
        &self,
        start: usize,
        end: usize,
        context_lines_before: usize,
        context_lines_after: usize,
    ) -> (usize, usize);
}
Expand description

A indexable string.

Required Methods§

Source

fn line_col_at(&self, pos: usize) -> (usize, usize)

Returns the line and column number of this Position.

Source

fn line_span_at(&self, pos: usize) -> (usize, usize)

Returns the start and the end of the line that contains the position at pos.

Source

fn span_with_context_lines( &self, start: usize, end: usize, context_lines_before: usize, context_lines_after: usize, ) -> (usize, usize)

Returns the start and the end of the (context_lines_before + 1 + context_lines_after) lines that contains the position at pos.

Implementations on Foreign Types§

Source§

impl<T: Indexer + ?Sized> Indexer for Box<T>

Source§

fn line_col_at(&self, pos: usize) -> (usize, usize)

Source§

fn line_span_at(&self, pos: usize) -> (usize, usize)

Source§

fn span_with_context_lines( &self, start: usize, end: usize, context_lines_before: usize, context_lines_after: usize, ) -> (usize, usize)

Source§

impl<T: Indexer + ?Sized> Indexer for Rc<T>

Source§

fn line_col_at(&self, pos: usize) -> (usize, usize)

Source§

fn line_span_at(&self, pos: usize) -> (usize, usize)

Source§

fn span_with_context_lines( &self, start: usize, end: usize, context_lines_before: usize, context_lines_after: usize, ) -> (usize, usize)

Source§

impl<T: Indexer + ?Sized> Indexer for Arc<T>

Source§

fn line_col_at(&self, pos: usize) -> (usize, usize)

Source§

fn line_span_at(&self, pos: usize) -> (usize, usize)

Source§

fn span_with_context_lines( &self, start: usize, end: usize, context_lines_before: usize, context_lines_after: usize, ) -> (usize, usize)

Implementors§