pub trait Shim:
Sync
+ 'static
+ Send {
type Sandbox: Sandbox;
// Required method
fn name() -> &'static str;
// Provided methods
fn version() -> Version { ... }
fn compiler() -> impl Future<Output = Option<impl Compiler>> + Send { ... }
fn supported_layers_types() -> &'static [&'static str] { ... }
}Expand description
The Shim trait provides a simplified API for running WebAssembly containers.
It handles the lifecycle of the container and OCI spec details for you.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn version() -> Version
fn version() -> Version
Returns the shim version.
Usually implemented using the version!() macro.
Sourcefn compiler() -> impl Future<Output = Option<impl Compiler>> + Send
fn compiler() -> impl Future<Output = Option<impl Compiler>> + Send
When compiler returns Some, the returned Compiler will be used to precompile
the layers before they are run.
Returns the compiler to be used by this engine
to precompile layers.
Sourcefn supported_layers_types() -> &'static [&'static str]
fn supported_layers_types() -> &'static [&'static str]
Return the supported OCI layer types This is used to filter only layers that are supported by the runtime. The default implementation returns the OCI layer type ‘application/vnd.bytecodealliance.wasm.component.layer.v0+wasm’ for WASM modules which can be contain with wasip1 or wasip2 components. Runtimes can override this to support other layer types such as lays that contain runtime specific configuration
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.