pub trait TextMap {
    fn text(&self) -> &str;
    fn offset_to_pos(&self, offset: usize) -> Option<Pos>;
    fn line_range(&self, line: u32) -> Option<Range<Pos>>;
    fn substr(&self, range: Range<Pos>) -> Option<&str>;

    fn offset_range_to_range(&self, offsets: Range<usize>) -> Option<Range<Pos>> { ... }
}
Expand description

Defines operations to convert between byte offsets and native Pos.

Most operations return an Option where None signals that the conversion wasn’t successful.

Required Methods

Provided Methods

Implementors