Trait TextMap
Source pub trait TextMap {
// Required methods
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>;
// Provided method
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.