Struct wit_parser::SourceMap
source · pub struct SourceMap { /* private fields */ }
Expand description
A listing of source files which are used to get parsed into an
UnresolvedPackage
.
Implementations§
source§impl SourceMap
impl SourceMap
sourcepub fn push_file(&mut self, path: &Path) -> Result<()>
pub fn push_file(&mut self, path: &Path) -> Result<()>
Reads the file path
on the filesystem and appends its contents to this
SourceMap
.
sourcepub fn push(&mut self, path: &Path, contents: impl Into<String>)
pub fn push(&mut self, path: &Path, contents: impl Into<String>)
Appends the given contents with the given path into this source map.
The path
provided is not read from the filesystem and is instead only
used during error messages. Each file added to a SourceMap
is
used to create the final parsed package namely by unioning all the
interfaces and worlds defined together. Note that each file has its own
personal namespace, however, for top-level use
and such.
sourcepub fn parse(self) -> Result<UnresolvedPackage>
pub fn parse(self) -> Result<UnresolvedPackage>
Parses the files added to this source map into an UnresolvedPackage
.
sourcepub fn source_files(&self) -> impl Iterator<Item = &Path>
pub fn source_files(&self) -> impl Iterator<Item = &Path>
Returns an iterator over all filenames added to this source map.
Trait Implementations§
Auto Trait Implementations§
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