pub struct Package { /* private fields */ }Expand description
Represents a WebAssembly component model package.
A package is a binary-encoded WebAssembly component.
Implementations§
source§impl Package
impl Package
sourcepub fn key(&self) -> BorrowedPackageKey<'_>
pub fn key(&self) -> BorrowedPackageKey<'_>
Gets the package key for the package.
sourcepub fn from_file(
name: &str,
version: Option<&Version>,
path: impl AsRef<Path>,
types: &mut Types
) -> Result<Self>
pub fn from_file( name: &str, version: Option<&Version>, path: impl AsRef<Path>, types: &mut Types ) -> Result<Self>
Creates a new package from the given file path.
The package will populate its types into the provided type collection.
sourcepub fn from_bytes(
name: &str,
version: Option<&Version>,
bytes: impl Into<Vec<u8>>,
types: &mut Types
) -> Result<Self>
pub fn from_bytes( name: &str, version: Option<&Version>, bytes: impl Into<Vec<u8>>, types: &mut Types ) -> Result<Self>
Creates a new package from the given bytes.
The package will populate its types into the provided type collection.
sourcepub fn bytes(&self) -> &[u8] ⓘ
pub fn bytes(&self) -> &[u8] ⓘ
Gets the bytes of the package.
The bytes are a binary-encoded WebAssembly component.
sourcepub fn instance_type(&self) -> InterfaceId
pub fn instance_type(&self) -> InterfaceId
Gets the id of the interface (i.e. instance type) that would result from instantiating the package.
sourcepub fn definitions(&self) -> &IndexMap<String, ItemKind>
pub fn definitions(&self) -> &IndexMap<String, ItemKind>
Gets the interfaces and worlds defined in this package.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
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