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: SourceMapA 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: &Path, contents: &str) -> Result<UnresolvedPackageGroup>
pub fn parse(path: &Path, contents: &str) -> Result<UnresolvedPackageGroup>
Parses the given string as a wit document.
The path argument is used for error reporting. The contents provided
will not be able to use pkg use paths to other documents.
sourcepub fn parse_path(path: &Path) -> Result<UnresolvedPackageGroup>
pub fn parse_path(path: &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: &Path) -> Result<UnresolvedPackageGroup>
pub fn parse_file(path: &Path) -> Result<UnresolvedPackageGroup>
Parses a WIT package from the file provided.
The WIT package returned will be a single-document package and will not
be able to use pkg paths to other documents.
sourcepub fn parse_dir(path: &Path) -> Result<UnresolvedPackageGroup>
pub fn parse_dir(path: &Path) -> Result<UnresolvedPackageGroup>
Parses a WIT package from the directory provided.
All files with the extension *.wit or *.wit.md will be loaded from
path into the returned package.