Struct wasmer_package::package::Package
source · pub struct Package {
base_dir: BaseDir,
manifest: Manifest,
atoms: BTreeMap<String, OwnedBuffer>,
strictness: Strictness,
volumes: BTreeMap<String, Arc<dyn WasmerPackageVolume + Send + Sync + 'static>>,
}
Expand description
A Wasmer package that will be lazily loaded from disk.
Fields§
§base_dir: BaseDir
§manifest: Manifest
§atoms: BTreeMap<String, OwnedBuffer>
§strictness: Strictness
§volumes: BTreeMap<String, Arc<dyn WasmerPackageVolume + Send + Sync + 'static>>
Implementations§
source§impl Package
impl Package
sourcepub fn from_tarball_file(
path: impl AsRef<Path>,
) -> Result<Self, WasmerPackageError>
pub fn from_tarball_file( path: impl AsRef<Path>, ) -> Result<Self, WasmerPackageError>
sourcepub fn from_tarball_file_with_strictness(
path: impl AsRef<Path>,
strictness: Strictness,
) -> Result<Self, WasmerPackageError>
pub fn from_tarball_file_with_strictness( path: impl AsRef<Path>, strictness: Strictness, ) -> Result<Self, WasmerPackageError>
sourcepub fn from_tarball(tarball: impl BufRead) -> Result<Self, WasmerPackageError>
pub fn from_tarball(tarball: impl BufRead) -> Result<Self, WasmerPackageError>
Load a package from a *.tar.gz
archive.
sourcepub fn from_tarball_with_strictness(
tarball: impl BufRead,
strictness: Strictness,
) -> Result<Self, WasmerPackageError>
pub fn from_tarball_with_strictness( tarball: impl BufRead, strictness: Strictness, ) -> Result<Self, WasmerPackageError>
Load a package from a *.tar.gz
archive.
sourcepub fn from_manifest(
wasmer_toml: impl AsRef<Path>,
) -> Result<Self, WasmerPackageError>
pub fn from_manifest( wasmer_toml: impl AsRef<Path>, ) -> Result<Self, WasmerPackageError>
Load a package from a wasmer.toml
manifest on disk.
sourcepub fn from_manifest_with_strictness(
wasmer_toml: impl AsRef<Path>,
strictness: Strictness,
) -> Result<Self, WasmerPackageError>
pub fn from_manifest_with_strictness( wasmer_toml: impl AsRef<Path>, strictness: Strictness, ) -> Result<Self, WasmerPackageError>
Load a package from a wasmer.toml
manifest on disk.
sourcepub fn from_json_manifest(manifest: PathBuf) -> Result<Self, WasmerPackageError>
pub fn from_json_manifest(manifest: PathBuf) -> Result<Self, WasmerPackageError>
(Re)loads a package from a manifest.json file which was created as the result of calling Container::unpack
sourcepub fn from_json_manifest_with_strictness(
manifest: PathBuf,
strictness: Strictness,
) -> Result<Self, WasmerPackageError>
pub fn from_json_manifest_with_strictness( manifest: PathBuf, strictness: Strictness, ) -> Result<Self, WasmerPackageError>
(Re)loads a package from a manifest.json file which was created as the result of calling Container::unpack
sourcepub fn from_in_memory(
manifest: WasmerManifest,
volumes: BTreeMap<String, MemoryVolume>,
atoms: BTreeMap<String, (Option<String>, OwnedBuffer)>,
metadata: MemoryVolume,
strictness: Strictness,
) -> Result<Self, WasmerPackageError>
pub fn from_in_memory( manifest: WasmerManifest, volumes: BTreeMap<String, MemoryVolume>, atoms: BTreeMap<String, (Option<String>, OwnedBuffer)>, metadata: MemoryVolume, strictness: Strictness, ) -> Result<Self, WasmerPackageError>
Create a Package
from an in-memory representation.
fn load( wasmer_toml: WasmerManifest, base_dir: impl Into<BaseDir>, strictness: Strictness, ) -> Result<Self, WasmerPackageError>
sourcepub fn webc_hash(&self) -> Option<[u8; 32]>
pub fn webc_hash(&self) -> Option<[u8; 32]>
Returns the Sha256 has of the webc represented by this Package
sourcepub fn volumes(
&self,
) -> impl Iterator<Item = &Arc<dyn WasmerPackageVolume + Sync + Send + 'static>>
pub fn volumes( &self, ) -> impl Iterator<Item = &Arc<dyn WasmerPackageVolume + Sync + Send + 'static>>
Returns all volumes in this package
sourcepub fn serialize(&self) -> Result<Bytes, Error>
pub fn serialize(&self) -> Result<Bytes, Error>
Serialize the package to a *.webc
v2 file, ignoring errors due to
missing files.
fn atom_entries(&self) -> Result<BTreeMap<PathSegment, FileEntry<'_>>, Error>
pub(crate) fn get_volume( &self, name: &str, ) -> Option<Arc<dyn WasmerPackageVolume + Sync + Send + 'static>>
pub(crate) fn volume_names(&self) -> Vec<Cow<'_, str>>
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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.