pub struct QuickJsSourceLocator<'source> { /* private fields */ }Expand description
Convert authoritative source-buffer byte offsets with pinned QuickJS’s
exact get_line_col rules: LF is the only newline and bytes shaped like
UTF-8 continuations do not advance the column. Raw parser inputs need not
themselves be valid UTF-8.
Implementations§
Source§impl<'source> QuickJsSourceLocator<'source>
impl<'source> QuickJsSourceLocator<'source>
pub const fn new(source: &'source str) -> Self
pub const fn from_bytes(source: &'source [u8]) -> Self
pub fn locate( self, offset: SourceOffset, ) -> Result<LineColumn, DebugMetadataError>
pub fn locate_byte_offset( self, byte_offset: usize, ) -> Result<LineColumn, DebugMetadataError>
Sourcepub fn index(self) -> Result<QuickJsSourceIndex<'source>, DebugMetadataError>
pub fn index(self) -> Result<QuickJsSourceIndex<'source>, DebugMetadataError>
Prepare bounded-distance lookups for consumers with many source sites. One-off diagnostics can keep using the allocation-free locator.
Trait Implementations§
Source§impl<'source> Clone for QuickJsSourceLocator<'source>
impl<'source> Clone for QuickJsSourceLocator<'source>
impl<'source> Copy for QuickJsSourceLocator<'source>
Auto Trait Implementations§
impl<'source> Freeze for QuickJsSourceLocator<'source>
impl<'source> RefUnwindSafe for QuickJsSourceLocator<'source>
impl<'source> Send for QuickJsSourceLocator<'source>
impl<'source> Sync for QuickJsSourceLocator<'source>
impl<'source> Unpin for QuickJsSourceLocator<'source>
impl<'source> UnsafeUnpin for QuickJsSourceLocator<'source>
impl<'source> UnwindSafe for QuickJsSourceLocator<'source>
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