Struct wapm_toml::Manifest

source ·
pub struct Manifest {
    pub package: Package,
    pub dependencies: Option<HashMap<String, String>>,
    pub module: Option<Vec<Module>>,
    pub command: Option<Vec<Command>>,
    pub fs: Option<HashMap<String, PathBuf>>,
    pub base_directory_path: PathBuf,
}
Expand description

The manifest represents the file used to describe a Wasm package.

The module field represents the wasm file to be published.

The source is used to create bundles with the fs section.

The fs section represents fs assets that will be made available to the program relative to its starting current directory (there may be issues with WASI). These are pairs of paths.

Fields§

§package: Package§dependencies: Option<HashMap<String, String>>§module: Option<Vec<Module>>§command: Option<Vec<Command>>§fs: Option<HashMap<String, PathBuf>>

Of the form Guest -> Host path

§base_directory_path: PathBuf

private data store the directory path of the manifest file for use later accessing relative path fields

Implementations§

source§

impl Manifest

source

pub fn parse(s: &str) -> Result<Self, Error>

source

pub fn find_in_directory<T: AsRef<Path>>(path: T) -> Result<Self, ManifestError>

Construct a manifest by searching in the specified directory for a manifest file

source

pub fn validate(&self) -> Result<(), ManifestError>

source

pub fn add_dependency( &mut self, dependency_name: String, dependency_version: String )

add a dependency

source

pub fn remove_dependency(&mut self, dependency_name: &str) -> Option<String>

remove dependency by package name

source

pub fn to_string(&self) -> Result<String>

source

pub fn manifest_path(&self) -> PathBuf

source

pub fn save(&self) -> Result<()>

Write the manifest to permanent storage

Trait Implementations§

source§

impl Clone for Manifest

source§

fn clone(&self) -> Manifest

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Manifest

source§

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

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

impl<'de> Deserialize<'de> for Manifest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Manifest

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,