Struct wit_parser::UnresolvedPackageGroup
source · pub struct UnresolvedPackageGroup {
pub packages: Vec<UnresolvedPackage>,
pub source_map: SourceMap,
}
Expand description
Tracks a set of packages, all pulled from the same group of WIT source files.
Fields§
§packages: Vec<UnresolvedPackage>
A set of packages that share source file(s).
source_map: SourceMap
A set of processed source files from which these packages have been parsed.
Implementations§
source§impl UnresolvedPackageGroup
impl UnresolvedPackageGroup
sourcepub fn new() -> UnresolvedPackageGroup
pub fn new() -> UnresolvedPackageGroup
Creates an empty set of packages.
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.