Skip to main content

DynSandbox

Trait DynSandbox 

Source
pub trait DynSandbox:
    SandboxBackend
    + Send
    + Sync {
    // Required method
    fn launch(
        &self,
        request: BackendRequest<'_>,
        context: &PathResolutionContext,
    ) -> Result<Box<dyn SandboxChild<Error = SandboxExecutionError> + Send>, SandboxExecutionError>;
}
Expand description

Execution through a reusable backend without naming its native child or error type.

Use Box<dyn DynSandbox> for ownership or Arc<dyn DynSandbox> to share a backend across threads. Each launch retains its own effective policy and child boundary. Native setup must already be complete before constructing the backend; this interface never installs system components implicitly.

The blanket implementation uses the backend’s Sandbox::prepare and Sandbox::spawn in sequence on the same instance. Implementing a backend remains a trusted integration responsibility, including native enforcement.

Required Methods§

Source

fn launch( &self, request: BackendRequest<'_>, context: &PathResolutionContext, ) -> Result<Box<dyn SandboxChild<Error = SandboxExecutionError> + Send>, SandboxExecutionError>

Prepares and starts a command in a new sandbox boundary.

Preparation failure prevents spawn. The returned child owns its native resources independently of the borrowed request and backend reference.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<B> DynSandbox for B
where B: Sandbox + Send + Sync, B::Child: Send + 'static, B::Error: Send + Sync,