pub struct NewLines { /* private fields */ }Expand description
A datastructure that stores the location of newline characters of a string. It also offers some useful methods to determine the line-number of an offset-location.
Implementations§
Source§impl NewLines
impl NewLines
pub fn build(str: &str) -> NewLines
Sourcepub fn get_line_nr(&self, offset: usize) -> usize
pub fn get_line_nr(&self, offset: usize) -> usize
returns the 0 based line-nr of the given offset-location
Sourcepub fn get_column(&self, line: usize, offset: usize) -> usize
pub fn get_column(&self, line: usize, offset: usize) -> usize
returns the 0 based column of the given offset-location
Sourcepub fn get_end_of_line(&self, line: usize) -> usize
pub fn get_end_of_line(&self, line: usize) -> usize
returns the 0 based column of end-of-line character for the given line
Trait Implementations§
impl Eq for NewLines
impl StructuralPartialEq for NewLines
Auto Trait Implementations§
impl Freeze for NewLines
impl RefUnwindSafe for NewLines
impl Send for NewLines
impl Sync for NewLines
impl Unpin for NewLines
impl UnsafeUnpin for NewLines
impl UnwindSafe for NewLines
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