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

source

pub fn from_tarball_file( path: impl AsRef<Path>, ) -> Result<Self, WasmerPackageError>

Load a Package from a *.tar.gz file on disk.

§Implementation Details

This will unpack the tarball to a temporary directory on disk and use memory-mapped files in order to reduce RAM usage.

source

pub fn from_tarball_file_with_strictness( path: impl AsRef<Path>, strictness: Strictness, ) -> Result<Self, WasmerPackageError>

Load a Package from a *.tar.gz file on disk.

§Implementation Details

This will unpack the tarball to a temporary directory on disk and use memory-mapped files in order to reduce RAM usage.

source

pub fn from_tarball(tarball: impl BufRead) -> Result<Self, WasmerPackageError>

Load a package from a *.tar.gz archive.

source

pub fn from_tarball_with_strictness( tarball: impl BufRead, strictness: Strictness, ) -> Result<Self, WasmerPackageError>

Load a package from a *.tar.gz archive.

source

pub fn from_manifest( wasmer_toml: impl AsRef<Path>, ) -> Result<Self, WasmerPackageError>

Load a package from a wasmer.toml manifest on disk.

source

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.

source

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

source

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

source

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.

source

fn load( wasmer_toml: WasmerManifest, base_dir: impl Into<BaseDir>, strictness: Strictness, ) -> Result<Self, WasmerPackageError>

source

pub fn webc_hash(&self) -> Option<[u8; 32]>

Returns the Sha256 has of the webc represented by this Package

source

pub fn manifest(&self) -> &WebcManifest

Get the WEBC manifest.

source

pub fn atoms(&self) -> &BTreeMap<String, OwnedBuffer>

Get all atoms in this package.

source

pub fn volumes( &self, ) -> impl Iterator<Item = &Arc<dyn WasmerPackageVolume + Sync + Send + 'static>>

Returns all volumes in this package

source

pub fn serialize(&self) -> Result<Bytes, Error>

Serialize the package to a *.webc v2 file, ignoring errors due to missing files.

source

fn atom_entries(&self) -> Result<BTreeMap<PathSegment, FileEntry<'_>>, Error>

source

pub(crate) fn get_volume( &self, name: &str, ) -> Option<Arc<dyn WasmerPackageVolume + Sync + Send + 'static>>

source

pub(crate) fn volume_names(&self) -> Vec<Cow<'_, str>>

Trait Implementations§

source§

impl Debug for Package

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Package> for Container

source§

fn from(value: Package) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T