pub struct LineMap {
pub line_starts: Vec<usize>,
}Expand description
A utility to find the line boundaries in a source string.
Fields§
§line_starts: Vec<usize>Byte offsets of each line start
Implementations§
Source§impl LineMap
impl LineMap
Sourcepub fn line_for_offset(&self, offset: usize) -> usize
pub fn line_for_offset(&self, offset: usize) -> usize
Returns the line number (1-based) for a byte offset.
Sourcepub fn col_for_offset(&self, offset: usize) -> usize
pub fn col_for_offset(&self, offset: usize) -> usize
Returns the column (1-based) for a byte offset.
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Returns the total number of lines.
Auto Trait Implementations§
impl Freeze for LineMap
impl RefUnwindSafe for LineMap
impl Send for LineMap
impl Sync for LineMap
impl Unpin for LineMap
impl UnsafeUnpin for LineMap
impl UnwindSafe for LineMap
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