Skip to main content

PositionProvider

Trait PositionProvider 

Source
pub trait PositionProvider {
    // Required methods
    fn position(&self, offset: usize) -> Position;
    fn set_offset(&mut self, offset: usize);
}
Expand description

A trait for providing the line and column information of a given byte offset in the haystack. It also provides a method to set the offset of the char indices iterator.

Required Methods§

Source

fn position(&self, offset: usize) -> Position

Returns the position of the given offset.

Source

fn set_offset(&mut self, offset: usize)

Set the position of the char indices iterator to the given offset. Use this to let the iterator start at a specific offset.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§