Skip to main content

SourceMap

Trait SourceMap 

Source
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§

Source

fn add_source(&mut self, source: &str) -> u32

Adds a source path and returns its source index.

Source

fn add_name(&mut self, name: &str) -> u32

Adds a symbol name and returns its name index.

Source

fn set_source_content(&mut self, source_index: u32, source_content: &str)

Sets the original content for a source index.

Source

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.

Source

fn from_data_url(source_root: &str, data_url: &str) -> Option<Self>
where Self: Sized,

Reads an inline source map data URL.

Source

fn find_closest_mapping( &mut self, line: u32, column: u32, ) -> Option<OriginalLocation>

Finds the closest original location for a generated position.

Source

fn get_source(&self, source_index: u32) -> Option<&str>

Returns the source path for a source index.

Source

fn get_name(&self, name_index: u32) -> Option<&str>

Returns the symbol name for a name index.

Source

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 ()

Source§

fn add_source(&mut self, _source: &str) -> u32

Source§

fn add_name(&mut self, _name: &str) -> u32

Source§

fn set_source_content(&mut self, _source_index: u32, _source_content: &str)

Source§

fn add_mapping( &mut self, _generated_line: u32, _generated_column: u32, _original: Option<OriginalLocation>, )

Source§

fn from_data_url(_source_root: &str, _data_url: &str) -> Option<Self>

Source§

fn find_closest_mapping( &mut self, _line: u32, _column: u32, ) -> Option<OriginalLocation>

Source§

fn get_source(&self, _source_index: u32) -> Option<&str>

Source§

fn get_name(&self, _name_index: u32) -> Option<&str>

Source§

fn get_source_content(&self, _source_index: u32) -> Option<&str>

Source§

impl SourceMap for SourceMap

Available on crate feature sourcemap only.
Source§

fn add_source(&mut self, source: &str) -> u32

Available on crate feature custom_sourcemap only.
Source§

fn add_name(&mut self, name: &str) -> u32

Available on crate feature custom_sourcemap only.
Source§

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>, )

Available on crate feature custom_sourcemap only.
Source§

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>

Available on crate feature custom_sourcemap only.
Source§

fn get_source(&self, source_index: u32) -> Option<&str>

Available on crate feature custom_sourcemap only.
Source§

fn get_name(&self, name_index: u32) -> Option<&str>

Available on crate feature custom_sourcemap only.
Source§

fn get_source_content(&self, source_index: u32) -> Option<&str>

Available on crate feature custom_sourcemap only.
Source§

impl<T: SourceMap + ?Sized> SourceMap for &mut T

Source§

fn add_source(&mut self, source: &str) -> u32

Source§

fn add_name(&mut self, name: &str) -> u32

Source§

fn set_source_content(&mut self, source_index: u32, source_content: &str)

Source§

fn add_mapping( &mut self, generated_line: u32, generated_column: u32, original: Option<OriginalLocation>, )

Source§

fn from_data_url(source_root: &str, data_url: &str) -> Option<Self>
where Self: Sized,

Source§

fn find_closest_mapping( &mut self, line: u32, column: u32, ) -> Option<OriginalLocation>

Source§

fn get_source(&self, source_index: u32) -> Option<&str>

Source§

fn get_name(&self, name_index: u32) -> Option<&str>

Source§

fn get_source_content(&self, source_index: u32) -> Option<&str>

Implementors§