Skip to main content

Sandbox

Trait Sandbox 

Source
pub trait Sandbox: Send + Sync {
    // Required methods
    fn load_module(&self, bytes: &[u8]) -> Result<Box<dyn SandboxInstance>>;
    fn name(&self) -> &'static str;
}
Expand description

A plugin runtime.

Implementations are cheap to clone: they share the underlying engine state. Each load_module produces an independent SandboxInstance with its own subprocess and an empty capability set.

Required Methods§

Source

fn load_module(&self, bytes: &[u8]) -> Result<Box<dyn SandboxInstance>>

Spawn a plugin subprocess.

For the process sandbox, bytes is interpreted as the UTF-8 encoded path to the plugin executable. (This keeps the trait signature byte-oriented so it matches the WASM sandbox’s load_module(&[u8]); the meaning of those bytes is runtime specific.)

Source

fn name(&self) -> &'static str

Human-readable runtime name (e.g. "process").

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§