pub struct SourceMap { /* private fields */ }Expand description
Keeps error locations aligned with input when a console adds wrapper text.
For example, a console may turn 1 + 2 into return 1 + 2 before running
it. Pass SourceMap::generated_prefix(7) to
Chunk::source_map to hide the added return
from source excerpts and positions. Wrappers cannot contain line breaks.
Script-visible strings are unchanged.
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub const fn generated_prefix(prefix_bytes: usize) -> Self
pub const fn generated_prefix(prefix_bytes: usize) -> Self
Marks this many leading bytes as generated text on the first line.
Sourcepub const fn generated_wrapper(prefix_bytes: usize, suffix_bytes: usize) -> Self
pub const fn generated_wrapper(prefix_bytes: usize, suffix_bytes: usize) -> Self
Removes same-line generated text on both sides of the original input.
Trait Implementations§
impl Copy for SourceMap
Auto Trait Implementations§
impl Freeze for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl UnsafeUnpin for SourceMap
impl UnwindSafe for SourceMap
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