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 host-import invocation.
Required Methods§
Sourcefn call(&mut self, function: &str, args: &[Value]) -> Result<Vec<Value>>
fn call(&mut self, function: &str, args: &[Value]) -> Result<Vec<Value>>
Invoke function with args. Returns the function’s results.
Sourcefn grant_capability(&mut self, cap: Capability) -> Result<()>
fn grant_capability(&mut self, cap: Capability) -> Result<()>
Grant cap to this instance. Grants are idempotent.
Sourcefn revoke_capability(&mut self, cap: &Capability) -> Result<()>
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".