pub struct LineIndex { /* private fields */ }Expand description
Maps flat TextSize offsets to/from (line, column) representation.
Implementations§
Source§impl LineIndex
impl LineIndex
Sourcepub fn try_line_col(&self, offset: TextSize) -> Option<LineCol>
pub fn try_line_col(&self, offset: TextSize) -> Option<LineCol>
Transforms the TextSize into a LineCol.
Returns None if the offset was invalid, e.g. if it extends past the end of the text or
points to the middle of a multi-byte character.
Sourcepub fn offset(&self, line_col: LineCol) -> Option<TextSize>
pub fn offset(&self, line_col: LineCol) -> Option<TextSize>
Transforms the LineCol into a TextSize.
Sourcepub fn to_wide(
&self,
enc: WideEncoding,
line_col: LineCol,
) -> Option<WideLineCol>
pub fn to_wide( &self, enc: WideEncoding, line_col: LineCol, ) -> Option<WideLineCol>
Transforms the LineCol with the given WideEncoding into a WideLineCol.
Sourcepub fn to_utf8(
&self,
enc: WideEncoding,
line_col: WideLineCol,
) -> Option<LineCol>
pub fn to_utf8( &self, enc: WideEncoding, line_col: WideLineCol, ) -> Option<LineCol>
Transforms the WideLineCol with the given WideEncoding into a LineCol.
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 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