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 a
UnresolvedPackageGroup
.
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