pub trait SourceMap {
// Required methods
fn add_source(&mut self, source: &str) -> u32;
fn add_name(&mut self, name: &str) -> u32;
fn set_source_content(&mut self, source_index: u32, source_content: &str);
fn add_mapping(
&mut self,
generated_line: u32,
generated_column: u32,
original: Option<OriginalLocation>,
);
fn from_data_url(source_root: &str, data_url: &str) -> Option<Self>
where Self: Sized;
fn find_closest_mapping(
&mut self,
line: u32,
column: u32,
) -> Option<OriginalLocation>;
fn get_source(&self, source_index: u32) -> Option<&str>;
fn get_name(&self, name_index: u32) -> Option<&str>;
fn get_source_content(&self, source_index: u32) -> Option<&str>;
}Available on crate feature
custom_sourcemap only.Expand description
A source map implementation that can receive generated mappings and provide input mappings for remapping.
Required Methods§
Sourcefn add_source(&mut self, source: &str) -> u32
fn add_source(&mut self, source: &str) -> u32
Adds a source path and returns its source index.
Sourcefn set_source_content(&mut self, source_index: u32, source_content: &str)
fn set_source_content(&mut self, source_index: u32, source_content: &str)
Sets the original content for a source index.
Sourcefn add_mapping(
&mut self,
generated_line: u32,
generated_column: u32,
original: Option<OriginalLocation>,
)
fn add_mapping( &mut self, generated_line: u32, generated_column: u32, original: Option<OriginalLocation>, )
Adds a mapping from a generated position to an optional original location.
Sourcefn from_data_url(source_root: &str, data_url: &str) -> Option<Self>where
Self: Sized,
fn from_data_url(source_root: &str, data_url: &str) -> Option<Self>where
Self: Sized,
Reads an inline source map data URL.
Sourcefn find_closest_mapping(
&mut self,
line: u32,
column: u32,
) -> Option<OriginalLocation>
fn find_closest_mapping( &mut self, line: u32, column: u32, ) -> Option<OriginalLocation>
Finds the closest original location for a generated position.
Sourcefn get_source(&self, source_index: u32) -> Option<&str>
fn get_source(&self, source_index: u32) -> Option<&str>
Returns the source path for a source index.
Sourcefn get_source_content(&self, source_index: u32) -> Option<&str>
fn get_source_content(&self, source_index: u32) -> Option<&str>
Returns the source content for a source index.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl SourceMap for ()
impl SourceMap for ()
fn add_source(&mut self, _source: &str) -> u32
fn add_name(&mut self, _name: &str) -> u32
fn set_source_content(&mut self, _source_index: u32, _source_content: &str)
fn add_mapping( &mut self, _generated_line: u32, _generated_column: u32, _original: Option<OriginalLocation>, )
fn from_data_url(_source_root: &str, _data_url: &str) -> Option<Self>
fn find_closest_mapping( &mut self, _line: u32, _column: u32, ) -> Option<OriginalLocation>
fn get_source(&self, _source_index: u32) -> Option<&str>
fn get_name(&self, _name_index: u32) -> Option<&str>
fn get_source_content(&self, _source_index: u32) -> Option<&str>
Source§impl SourceMap for SourceMap
Available on crate feature sourcemap only.
impl SourceMap for SourceMap
Available on crate feature
sourcemap only.Source§fn add_source(&mut self, source: &str) -> u32
fn add_source(&mut self, source: &str) -> u32
Available on crate feature
custom_sourcemap only.Source§fn set_source_content(&mut self, source_index: u32, source_content: &str)
fn set_source_content(&mut self, source_index: u32, source_content: &str)
Available on crate feature
custom_sourcemap only.Source§fn add_mapping(
&mut self,
generated_line: u32,
generated_column: u32,
original: Option<OriginalLocation>,
)
fn add_mapping( &mut self, generated_line: u32, generated_column: u32, original: Option<OriginalLocation>, )
Available on crate feature
custom_sourcemap only.Source§fn from_data_url(source_root: &str, data_url: &str) -> Option<Self>
fn from_data_url(source_root: &str, data_url: &str) -> Option<Self>
Available on crate feature
custom_sourcemap only.Source§fn find_closest_mapping(
&mut self,
line: u32,
column: u32,
) -> Option<OriginalLocation>
fn find_closest_mapping( &mut self, line: u32, column: u32, ) -> Option<OriginalLocation>
Available on crate feature
custom_sourcemap only.Source§fn get_source(&self, source_index: u32) -> Option<&str>
fn get_source(&self, source_index: u32) -> Option<&str>
Available on crate feature
custom_sourcemap only.