Struct sourcemap::SourceMapBuilder
[−]
[src]
pub struct SourceMapBuilder { /* fields omitted */ }
Helper for sourcemap generation
This helper exists because generating and modifying SourceMap
objects is generally not very comfortable. As a general aid this
type can help.
Methods
impl SourceMapBuilder
[src]
fn new(file: Option<&str>) -> SourceMapBuilder
Creates a new source map builder and sets the file.
fn set_file(&mut self, value: Option<&str>)
Sets the file for the sourcemap (optional)
fn get_file(&self) -> Option<&str>
Returns the currently set file.
fn add_source(&mut self, src: &str) -> u32
Registers a new source with the builder and returns the source ID.
fn set_source(&mut self, src_id: u32, src: &str)
Changes the source name for an already set source.
fn get_source(&self, src_id: u32) -> Option<&str>
Looks up a source name for an ID.
fn set_source_contents(&mut self, src_id: u32, contents: Option<&str>)
Sets the source contents for an already existing source.
fn get_source_contents(&self, src_id: u32) -> Option<&str>
Returns the current source contents for a source.
fn has_source_contents(&self, src_id: u32) -> bool
Checks if a given source ID has source contents available.
fn load_local_source_contents(&mut self,
base_path: Option<&Path>)
-> Result<usize>
base_path: Option<&Path>)
-> Result<usize>
Loads source contents from locally accessible files if referenced accordingly. Returns the number of loaded source contents
fn add_name(&mut self, name: &str) -> u32
Registers a name with the builder and returns the name ID.
fn add(&mut self,
dst_line: u32,
dst_col: u32,
src_line: u32,
src_col: u32,
source: Option<&str>,
name: Option<&str>)
-> RawToken
dst_line: u32,
dst_col: u32,
src_line: u32,
src_col: u32,
source: Option<&str>,
name: Option<&str>)
-> RawToken
Adds a new mapping to the builder.
fn add_token(&mut self, token: &Token, with_name: bool) -> RawToken
Shortcut for adding a new mapping based of an already existing token, optionally removing the name.
fn into_sourcemap(self) -> SourceMap
Converts the builder into a sourcemap.