pub struct LineStartsCache { /* private fields */ }Expand description
Caches byte offsets for line starts to speed up coordinate conversion.
Implementations§
Source§impl LineStartsCache
impl LineStartsCache
Sourcepub fn offset_to_position(&self, text: &str, offset: usize) -> (u32, u32)
pub fn offset_to_position(&self, text: &str, offset: usize) -> (u32, u32)
Converts a byte offset in text to (line, column_utf16).
Sourcepub fn position_to_offset(&self, text: &str, line: u32, character: u32) -> usize
pub fn position_to_offset(&self, text: &str, line: u32, character: u32) -> usize
Converts (line, column_utf16) into a byte offset in text.
Trait Implementations§
Source§impl Clone for LineStartsCache
impl Clone for LineStartsCache
Source§fn clone(&self) -> LineStartsCache
fn clone(&self) -> LineStartsCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LineStartsCache
impl RefUnwindSafe for LineStartsCache
impl Send for LineStartsCache
impl Sync for LineStartsCache
impl Unpin for LineStartsCache
impl UnsafeUnpin for LineStartsCache
impl UnwindSafe for LineStartsCache
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