pub struct SourceMapGenerator { /* private fields */ }Expand description
Builder for source maps
Implementations§
Source§impl SourceMapGenerator
impl SourceMapGenerator
pub const fn new(file: String) -> SourceMapGenerator
Sourcepub fn set_source_root(&mut self, root: String)
pub fn set_source_root(&mut self, root: String)
Set the source root
Sourcepub fn add_source(&mut self, source: String) -> u32
pub fn add_source(&mut self, source: String) -> u32
Add a source file
Sourcepub fn add_source_with_content(
&mut self,
source: String,
content: String,
) -> u32
pub fn add_source_with_content( &mut self, source: String, content: String, ) -> u32
Add a source file with content
Sourcepub fn add_mapping(
&mut self,
generated_line: u32,
generated_column: u32,
source_index: u32,
original_line: u32,
original_column: u32,
name_index: Option<u32>,
)
pub fn add_mapping( &mut self, generated_line: u32, generated_column: u32, source_index: u32, original_line: u32, original_column: u32, name_index: Option<u32>, )
Add a mapping
Sourcepub fn add_simple_mapping(
&mut self,
generated_line: u32,
generated_column: u32,
source_index: u32,
original_line: u32,
original_column: u32,
)
pub fn add_simple_mapping( &mut self, generated_line: u32, generated_column: u32, source_index: u32, original_line: u32, original_column: u32, )
Add a simple mapping (no name)
Sourcepub fn shift_generated_lines(&mut self, from_line: u32, delta: u32)
pub fn shift_generated_lines(&mut self, from_line: u32, delta: u32)
Shift all mappings at or after from_line by delta lines.
Used when inserting generated lines (e.g., hoisted temp var declarations)
into the output after emit is complete.
Sourcepub fn generate_json(&mut self) -> String
pub fn generate_json(&mut self) -> String
Generate source map as JSON string
Sourcepub fn generate_inline(&mut self) -> String
pub fn generate_inline(&mut self) -> String
Generate inline source map comment
Sourcepub fn to_inline_comment(&mut self) -> String
pub fn to_inline_comment(&mut self) -> String
Alias for generate_inline (compatibility)
Auto Trait Implementations§
impl Freeze for SourceMapGenerator
impl RefUnwindSafe for SourceMapGenerator
impl Send for SourceMapGenerator
impl Sync for SourceMapGenerator
impl Unpin for SourceMapGenerator
impl UnsafeUnpin for SourceMapGenerator
impl UnwindSafe for SourceMapGenerator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more