[−][src]Struct sourcemap::SourceMapBuilder
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]
pub fn new(file: Option<&str>) -> SourceMapBuilder
[src]
Creates a new source map builder and sets the file.
pub fn set_file(&mut self, value: Option<&str>)
[src]
Sets the file for the sourcemap (optional)
pub fn get_file(&self) -> Option<&str>
[src]
Returns the currently set file.
pub fn add_source(&mut self, src: &str) -> u32
[src]
Registers a new source with the builder and returns the source ID.
pub fn set_source(&mut self, src_id: u32, src: &str)
[src]
Changes the source name for an already set source.
pub fn get_source(&self, src_id: u32) -> Option<&str>
[src]
Looks up a source name for an ID.
pub fn set_source_contents(&mut self, src_id: u32, contents: Option<&str>)
[src]
Sets the source contents for an already existing source.
pub fn get_source_contents(&self, src_id: u32) -> Option<&str>
[src]
Returns the current source contents for a source.
pub fn has_source_contents(&self, src_id: u32) -> bool
[src]
Checks if a given source ID has source contents available.
pub fn load_local_source_contents(
&mut self,
base_path: Option<&Path>
) -> Result<usize>
[src]
&mut self,
base_path: Option<&Path>
) -> Result<usize>
Loads source contents from locally accessible files if referenced accordingly. Returns the number of loaded source contents
pub fn add_name(&mut self, name: &str) -> u32
[src]
Registers a name with the builder and returns the name ID.
pub fn add(
&mut self,
dst_line: u32,
dst_col: u32,
src_line: u32,
src_col: u32,
source: Option<&str>,
name: Option<&str>
) -> RawToken
[src]
&mut self,
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.
pub fn add_token(&mut self, token: &Token, with_name: bool) -> RawToken
[src]
Shortcut for adding a new mapping based of an already existing token, optionally removing the name.
pub fn strip_prefixes<S: AsRef<str>>(&mut self, prefixes: &[S])
[src]
Strips common prefixes from the sources in the builder
pub fn into_sourcemap(self) -> SourceMap
[src]
Converts the builder into a sourcemap.
Auto Trait Implementations
impl Send for SourceMapBuilder
impl Sync for SourceMapBuilder
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,