pub struct LineIndex { /* private fields */ }Expand description
An index over a document’s byte offsets that resolves byte offsets to
(line, column) pairs on demand.
Constructed once per document from the source &str. Stores the byte
offset of each line terminator (\n, \r, or \r\n) in sorted order.
Line/column are resolved via binary search in O(log n) time.
Line numbers are 1-based; column numbers are 0-based codepoint counts.
Implementations§
Trait Implementations§
impl Eq for LineIndex
impl StructuralPartialEq for LineIndex
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