Struct wit_parser::UnresolvedPackage
source · pub struct UnresolvedPackage {
pub name: PackageName,
pub worlds: Arena<World>,
pub interfaces: Arena<Interface>,
pub types: Arena<TypeDef>,
pub foreign_deps: IndexMap<PackageName, IndexMap<String, AstItem>>,
pub docs: Docs,
/* private fields */
}
Expand description
Representation of a parsed WIT package which has not resolved external dependencies yet.
This representation has performed internal resolution of the WIT package itself, ensuring that all references internally are valid and the WIT was syntactically valid and such.
The fields of this structure represent a flat list of arrays unioned from
all documents within the WIT package. This means, for example, that all
types from all documents are located in self.types
. The fields of each
item can help splitting back out into packages/interfaces/etc as necessary.
Note that an UnresolvedPackage
cannot be queried in general about
information such as size or alignment as that would require resolution of
foreign dependencies. Translations such as to-binary additionally are not
supported on an UnresolvedPackage
due to the lack of knowledge about the
foreign types. This is intended to be an intermediate state which can be
inspected by embedders, if necessary, before quickly transforming to a
Resolve
to fully work with a WIT package.
After an UnresolvedPackage
is parsed it can be fully resolved with
Resolve::push
. During this operation a dependency map is specified which
will connect the foreign_deps
field of this structure to packages
previously inserted within the Resolve
. Embedders are responsible for
performing this resolution themselves.
Fields§
§name: PackageName
The namespace, name, and version information for this package.
worlds: Arena<World>
All worlds from all documents within this package.
Each world lists the document that it is from.
interfaces: Arena<Interface>
All interfaces from all documents within this package.
Each interface lists the document that it is from. Interfaces are listed in topological order as well so iteration through this arena will only reference prior elements already visited when working with recursive references.
types: Arena<TypeDef>
All types from all documents within this package.
Each type lists the interface or world that defined it, or nothing if it’s an anonymous type. Types are listed in this arena in topological order to ensure that iteration through this arena will only reference other types transitively that are already iterated over.
foreign_deps: IndexMap<PackageName, IndexMap<String, AstItem>>
All foreign dependencies that this package depends on.
These foreign dependencies must be resolved to convert this unresolved
package into a Resolve
. The map here is keyed by the name of the
foreign package that this depends on, and the sub-map is keyed by an
interface name followed by the identifier within self.interfaces
. The
fields of self.interfaces
describes the required types that are from
each foreign interface.
docs: Docs
Doc comments for this package.
Trait Implementations§
source§impl Clone for UnresolvedPackage
impl Clone for UnresolvedPackage
source§fn clone(&self) -> UnresolvedPackage
fn clone(&self) -> UnresolvedPackage
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 UnresolvedPackage
impl RefUnwindSafe for UnresolvedPackage
impl Send for UnresolvedPackage
impl Sync for UnresolvedPackage
impl Unpin for UnresolvedPackage
impl UnwindSafe for UnresolvedPackage
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)