Struct line_numbers::LinePositions
source · pub struct LinePositions { /* private fields */ }
Expand description
A struct for efficiently converting absolute string positions to line-relative positions.
Implementations§
source§impl LinePositions
impl LinePositions
sourcepub fn from_offset(&self, offset: usize) -> LineNumber
pub fn from_offset(&self, offset: usize) -> LineNumber
sourcepub fn from_region(
&self,
region_start: usize,
region_end: usize
) -> Vec<SingleLineSpan>
pub fn from_region( &self, region_start: usize, region_end: usize ) -> Vec<SingleLineSpan>
Convert this region into line spans. If the region includes a newline, the vec will contain multiple items.
Panics
Panics if region_start
or region_end
are out of bounds.
pub fn from_region_relative_to( &self, start: SingleLineSpan, region_start: usize, region_end: usize ) -> Vec<SingleLineSpan>
Trait Implementations§
source§impl Debug for LinePositions
impl Debug for LinePositions
Auto Trait Implementations§
impl RefUnwindSafe for LinePositions
impl Send for LinePositions
impl Sync for LinePositions
impl Unpin for LinePositions
impl UnwindSafe for LinePositions
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