pub struct LineIndex { /* private fields */ }Expand description
Owns the text as well as its index, so line access cannot use unrelated text.
Implementations§
Source§impl LineIndex
impl LineIndex
pub fn new(source: &str) -> Result<Self, SourceError>
pub fn source(&self) -> &str
pub fn line_col(&self, offset: u32) -> Result<(u32, u32), SourceError>
pub fn line_count(&self) -> u32
pub fn byte_offset(&self, line: u32, col: u32) -> Result<u32, SourceError>
pub fn line_text(&self, line: u32) -> Result<&str, SourceError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LineIndex
impl RefUnwindSafe for LineIndex
impl Send for LineIndex
impl Sync for LineIndex
impl Unpin for LineIndex
impl UnsafeUnpin 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