pub struct ConcatSourceMapBuilder { /* private fields */ }
Expand description
The ConcatSourceMapBuilder
is a helper to concat sourcemaps.
Implementations§
Source§impl ConcatSourceMapBuilder
impl ConcatSourceMapBuilder
Sourcepub fn with_capacity(
names_len: usize,
sources_len: usize,
tokens_len: usize,
token_chunks_len: usize,
) -> Self
pub fn with_capacity( names_len: usize, sources_len: usize, tokens_len: usize, token_chunks_len: usize, ) -> Self
Create new ConcatSourceMapBuilder
with pre-allocated capacity.
Allocating capacity before adding sourcemaps with add_sourcemap
avoids memory copies
and increases performance.
Alternatively, use from_sourcemaps
.
Sourcepub fn from_sourcemaps(sourcemap_and_line_offsets: &[(&SourceMap, u32)]) -> Self
pub fn from_sourcemaps(sourcemap_and_line_offsets: &[(&SourceMap, u32)]) -> Self
Create new ConcatSourceMapBuilder
from an array of SourceMap
s and line offsets.
This avoids memory copies versus creating builder with ConcatSourceMapBuilder::default()
and then adding sourcemaps individually with add_sourcemap
.
§Example
let builder = ConcatSourceMapBuilder::from_sourcemaps(&[
(&sourcemap1, 0),
(&sourcemap2, 100),
]);
let combined_sourcemap = builder.into_sourcemap();
pub fn add_sourcemap(&mut self, sourcemap: &SourceMap, line_offset: u32)
pub fn into_sourcemap(self) -> SourceMap
Trait Implementations§
Source§impl Debug for ConcatSourceMapBuilder
impl Debug for ConcatSourceMapBuilder
Source§impl Default for ConcatSourceMapBuilder
impl Default for ConcatSourceMapBuilder
Source§fn default() -> ConcatSourceMapBuilder
fn default() -> ConcatSourceMapBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConcatSourceMapBuilder
impl RefUnwindSafe for ConcatSourceMapBuilder
impl Send for ConcatSourceMapBuilder
impl Sync for ConcatSourceMapBuilder
impl Unpin for ConcatSourceMapBuilder
impl UnwindSafe for ConcatSourceMapBuilder
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