pub struct SourceMap { /* private fields */ }Expand description
a source map: [file, line, column, content] lookups, json / data url output
Implementations§
Source§impl SourceMap
impl SourceMap
pub fn new() -> Self
Sourcepub fn parse(source: &str) -> Result<Self, String>
pub fn parse(source: &str) -> Result<Self, String>
parse a source map: json, or a data: url (base64 or url encoded)
Sourcepub fn from_object(object: &SourceMapObject) -> Self
pub fn from_object(object: &SourceMapObject) -> Self
a source map from a source map object
Sourcepub fn add_source_content(
&mut self,
id: i64,
file_name: Option<&str>,
content: Option<&str>,
)
pub fn add_source_content( &mut self, id: i64, file_name: Option<&str>, content: Option<&str>, )
add a source
Sourcepub fn add(&mut self, maps: &[[i64; 5]]) -> Result<(), String>
pub fn add(&mut self, maps: &[[i64; 5]]) -> Result<(), String>
add mappings [newLine, newColumn, srcId, ln, col]
Sourcepub fn compute_positions(&mut self)
pub fn compute_positions(&mut self)
compute the original positions
Sourcepub fn find(
&mut self,
line: i64,
column: i64,
) -> Option<Vec<(Option<Rc<str>>, i64, i64, Option<Rc<str>>)>>
pub fn find( &mut self, line: i64, column: i64, ) -> Option<Vec<(Option<Rc<str>>, i64, i64, Option<Rc<str>>)>>
original sources, lines and columns of a position: [source, line, column, content]
Sourcepub fn to_json(&self) -> SourceMapObject
pub fn to_json(&self) -> SourceMapObject
source map object
Trait Implementations§
Auto Trait Implementations§
impl !Send for SourceMap
impl !Sync for SourceMap
impl Forget for SourceMap
impl Freeze for SourceMap
impl Move for SourceMap
impl RefUnwindSafe for SourceMap
impl Unpin for SourceMap
impl UnsafeUnpin for SourceMap
impl UnwindSafe for SourceMap
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