pub struct SourceMapBuilder { /* private fields */ }Expand description
Builder for incrementally constructing a SourceMap from iterators.
Avoids the need to pre-collect sources, names, and mappings into Vecs.
Delegates to SourceMap::from_parts internally.
Implementations§
Source§impl SourceMapBuilder
impl SourceMapBuilder
Sourcepub fn source_root(self, root: impl Into<String>) -> Self
pub fn source_root(self, root: impl Into<String>) -> Self
Set the source root prefix.
Sourcepub fn sources(
self,
sources: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn sources( self, sources: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Replace the source list.
Sourcepub fn sources_content(
self,
content: impl IntoIterator<Item = Option<impl Into<String>>>,
) -> Self
pub fn sources_content( self, content: impl IntoIterator<Item = Option<impl Into<String>>>, ) -> Self
Replace the source content list. Entries are parallel to sources.
Sourcepub fn names(self, names: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn names(self, names: impl IntoIterator<Item = impl Into<String>>) -> Self
Replace the name list.
Sourcepub fn mappings(self, mappings: impl IntoIterator<Item = Mapping>) -> Self
pub fn mappings(self, mappings: impl IntoIterator<Item = Mapping>) -> Self
Replace the decoded mapping list.
Mappings must be sorted by (generated_line, generated_column).
Sourcepub fn ignore_list(self, list: impl IntoIterator<Item = u32>) -> Self
pub fn ignore_list(self, list: impl IntoIterator<Item = u32>) -> Self
Replace the ignore-list source indices.
Sourcepub fn extension(self, key: impl Into<String>, value: Value) -> Self
pub fn extension(self, key: impl Into<String>, value: Value) -> Self
Add one extension field.
Only x_ and x- extension keys are retained in the built SourceMap,
matching JSON parsing behavior.
Sourcepub fn extensions<K, I>(self, extensions: I) -> Self
pub fn extensions<K, I>(self, extensions: I) -> Self
Replace extension fields.
Only x_ and x- extension keys are retained in the built SourceMap,
matching JSON parsing behavior.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SourceMapBuilder
impl RefUnwindSafe for SourceMapBuilder
impl Send for SourceMapBuilder
impl Sync for SourceMapBuilder
impl Unpin for SourceMapBuilder
impl UnsafeUnpin for SourceMapBuilder
impl UnwindSafe for SourceMapBuilder
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