pub struct LineIndex { /* private fields */ }Expand description
Maps byte offsets to Positions. Built once per file, queried many times.
Implementations§
Source§impl LineIndex
impl LineIndex
pub fn new(text: &str) -> Self
Sourcepub fn line_start(&self, line: usize) -> Option<usize>
pub fn line_start(&self, line: usize) -> Option<usize>
Byte offset where line starts.
Sourcepub fn line_text<'t>(&self, text: &'t str, line: usize) -> Option<&'t str>
pub fn line_text<'t>(&self, text: &'t str, line: usize) -> Option<&'t str>
The text of line without its line terminator.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LineIndex
impl RefUnwindSafe for LineIndex
impl Send for LineIndex
impl Sync for LineIndex
impl Unpin for LineIndex
impl UnsafeUnpin for LineIndex
impl UnwindSafe for LineIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more