Struct wit_parser::UnresolvedPackageGroup
source · pub struct UnresolvedPackageGroup {
pub main: UnresolvedPackage,
pub nested: Vec<UnresolvedPackage>,
pub source_map: SourceMap,
}
Expand description
Tracks a set of packages, all pulled from the same group of WIT source files.
Fields§
§main: UnresolvedPackage
The “main” package in this package group which was found at the root of the WIT files.
Note that this is required to be present in all WIT files.
nested: Vec<UnresolvedPackage>
Nested packages found while parsing main
, if any.
source_map: SourceMap
A set of processed source files from which these packages have been parsed.
Implementations§
source§impl UnresolvedPackageGroup
impl UnresolvedPackageGroup
sourcepub fn parse(
path: impl AsRef<Path>,
contents: &str,
) -> Result<UnresolvedPackageGroup>
pub fn parse( path: impl AsRef<Path>, contents: &str, ) -> Result<UnresolvedPackageGroup>
Parses the given string as a wit document.
The path
argument is used for error reporting. The contents
provided
are considered to be the contents of path
. This function does not read
the filesystem.
sourcepub fn parse_path(path: impl AsRef<Path>) -> Result<UnresolvedPackageGroup>
pub fn parse_path(path: impl AsRef<Path>) -> Result<UnresolvedPackageGroup>
Parse a WIT package at the provided path.
The path provided is inferred whether it’s a file or a directory. A file
is parsed with UnresolvedPackageGroup::parse_file
and a directory is
parsed with UnresolvedPackageGroup::parse_dir
.
sourcepub fn parse_file(path: impl AsRef<Path>) -> Result<UnresolvedPackageGroup>
pub fn parse_file(path: impl AsRef<Path>) -> Result<UnresolvedPackageGroup>
Parses a WIT package from the file provided.
The return value represents all packages found in the WIT file which might be either one or multiple depending on the syntax used.
sourcepub fn parse_dir(path: impl AsRef<Path>) -> Result<UnresolvedPackageGroup>
pub fn parse_dir(path: impl AsRef<Path>) -> Result<UnresolvedPackageGroup>
Parses a WIT package from the directory provided.
This method will look at all files under the path
specified. All
*.wit
files are parsed and assumed to be part of the same package
grouping. This is useful when a WIT package is split across multiple
files.
Trait Implementations§
source§impl Clone for UnresolvedPackageGroup
impl Clone for UnresolvedPackageGroup
source§fn clone(&self) -> UnresolvedPackageGroup
fn clone(&self) -> UnresolvedPackageGroup
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for UnresolvedPackageGroup
impl RefUnwindSafe for UnresolvedPackageGroup
impl Send for UnresolvedPackageGroup
impl Sync for UnresolvedPackageGroup
impl Unpin for UnresolvedPackageGroup
impl UnwindSafe for UnresolvedPackageGroup
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
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)
clone_to_uninit
)