pub struct SourceMap { /* private fields */ }Expand description
Registry of all sources.
Implementations§
Source§impl SourceMap
impl SourceMap
pub fn new() -> Self
Sourcepub fn add_one_liner(&mut self, content: &str) -> SourceId
pub fn add_one_liner(&mut self, content: &str) -> SourceId
Add a one-liner source (CLI -q argument, REPL, tests).
Sourcepub fn add_file(&mut self, path: &str, content: &str) -> SourceId
pub fn add_file(&mut self, path: &str, content: &str) -> SourceId
Add a file source with its path.
Sourcepub fn one_liner(content: &str) -> Self
pub fn one_liner(content: &str) -> Self
Create a SourceMap with a single one-liner source. Convenience for single-source use cases (CLI, REPL, tests).
Sourcepub fn kind(&self, id: SourceId) -> &SourceKind
pub fn kind(&self, id: SourceId) -> &SourceKind
Get the kind of a source by ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin 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