Skip to main content

SandboxInstance

Trait SandboxInstance 

Source
pub trait SandboxInstance: Send + Sync {
    // Required methods
    fn call(&mut self, function: &str, args: &[Value]) -> Result<Vec<Value>>;
    fn grant_capability(&mut self, cap: Capability) -> Result<()>;
    fn revoke_capability(&mut self, cap: &Capability) -> Result<()>;
}
Expand description

A loaded, capability-bound plugin.

Instances are mutable: capabilities can be granted and revoked between calls. A revoked capability takes effect immediately on the next call.

Required Methods§

Source

fn call(&mut self, function: &str, args: &[Value]) -> Result<Vec<Value>>

Invoke function with args. Returns the function’s results.

Source

fn grant_capability(&mut self, cap: Capability) -> Result<()>

Grant cap to this instance. Grants are idempotent.

Source

fn revoke_capability(&mut self, cap: &Capability) -> Result<()>

Revoke the matching capability. Revokes are idempotent.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§