#[non_exhaustive]pub struct WasmSpec {
pub module: PathBuf,
pub args: Vec<String>,
pub env: TaskEnv,
}Expand description
Specification for WebAssembly module execution via a WASI-compatible runtime.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.module: PathBufPath to the .wasm module.
args: Vec<String>Arguments passed to the WASI main entrypoint.
env: TaskEnvEnvironment variables exposed to the WASI module.
Implementations§
Source§impl WasmSpec
impl WasmSpec
Sourcepub fn new(module: PathBuf, args: Vec<String>, env: TaskEnv) -> Self
pub fn new(module: PathBuf, args: Vec<String>, env: TaskEnv) -> Self
Creates a WASM spec.
WasmSpec is #[non_exhaustive].
Use this constructor outside the crate.
Validation occurs when the workload enters a crate::TaskSpec.
§Example
use std::path::PathBuf;
use solti_model::{TaskEnv, WasmSpec};
let spec = WasmSpec::new(PathBuf::from("job.wasm"), vec!["--help".into()], TaskEnv::default());
assert_eq!(spec.module, PathBuf::from("job.wasm"));Sourcepub fn validate(&self) -> ModelResult<()>
pub fn validate(&self) -> ModelResult<()>
Validates structural constraints.
§Errors
Returns ModelError::Invalid when the module path is empty.
§Example
use std::path::PathBuf;
use solti_model::{TaskEnv, WasmSpec};
let spec = WasmSpec::new(PathBuf::from("job.wasm"), vec![], TaskEnv::default());
spec.validate().unwrap();Trait Implementations§
Source§impl<'de> Deserialize<'de> for WasmSpec
impl<'de> Deserialize<'de> for WasmSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for WasmSpec
Source§impl JsonSchema for WasmSpec
impl JsonSchema for WasmSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for WasmSpec
Auto Trait Implementations§
impl Freeze for WasmSpec
impl RefUnwindSafe for WasmSpec
impl Send for WasmSpec
impl Sync for WasmSpec
impl Unpin for WasmSpec
impl UnsafeUnpin for WasmSpec
impl UnwindSafe for WasmSpec
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