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<UnresolvedPackageGroup>
pub fn parse(self) -> Result<UnresolvedPackageGroup>
Parses the files added to this source map into one or more UnresolvedPackage
s.
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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)