Skip to main content

Sandbox

Trait Sandbox 

Source
pub trait Sandbox:
    Send
    + Sync
    + Debug {
    // Required method
    fn run<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        command: &'life1 Command,
        grant: &'life2 GrantSet,
    ) -> Pin<Box<dyn Future<Output = Result<Outcome, SandboxError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Runs a command under a grant, or refuses to.

Feature 09 will implement this with real isolation. Until then Unconfined implements it with none, and says so.

Required Methods§

Source

fn run<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, command: &'life1 Command, grant: &'life2 GrantSet, ) -> Pin<Box<dyn Future<Output = Result<Outcome, SandboxError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Run command, confined to grant.

§Errors

SandboxError::Unenforceable if this sandbox cannot confine the command to the grant — which it must return rather than run the command with more authority than was granted. SandboxError::Spawn if the program could not be started.

A command that ran and failed is not an error: that is an Outcome with a non-zero exit, and deciding what it means is the checker’s job.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§