pub struct LineOffsetTable { /* private fields */ }Expand description
Pre-computed line-start byte-offset table for converting V8 byte offsets into Istanbul line/column positions in O(log n) per lookup.
The source is consumed once at construction; subsequent lookups are allocation-free.
Implementations§
Source§impl LineOffsetTable
impl LineOffsetTable
Sourcepub fn from_source(source: &str) -> Self
pub fn from_source(source: &str) -> Self
Build a table from the full source text. The source must be UTF-8 with LF, CRLF, or CR line endings (mixed endings are tolerated).
Sourcepub fn position(&self, byte_offset: u32) -> IstanbulPosition
pub fn position(&self, byte_offset: u32) -> IstanbulPosition
Convert a byte offset to a 1-indexed line + 0-indexed column.
Offsets at or past the end of the source clamp to the last line + remaining column.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LineOffsetTable
impl RefUnwindSafe for LineOffsetTable
impl Send for LineOffsetTable
impl Sync for LineOffsetTable
impl Unpin for LineOffsetTable
impl UnsafeUnpin for LineOffsetTable
impl UnwindSafe for LineOffsetTable
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