pub struct LineIndex { /* private fields */ }Implementations§
Source§impl LineIndex
impl LineIndex
pub fn new(source: &[u8]) -> Self
Sourcepub fn line_col(&self, offset: usize) -> (usize, usize)
pub fn line_col(&self, offset: usize) -> (usize, usize)
Returns (line, column) for a given byte offset. Both line and column are 0-based.
Sourcepub fn offset(&self, line: usize, col: usize) -> Option<usize>
pub fn offset(&self, line: usize, col: usize) -> Option<usize>
Returns the byte offset for a given (line, column). Both line and column are 0-based.
pub fn to_lsp_range(&self, span: Span) -> (usize, usize, usize, usize)
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 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