Skip to main content

SandboxChild

Trait SandboxChild 

Source
pub trait SandboxChild {
    type Error: Error + 'static;

    // Required methods
    fn id(&self) -> u32;
    fn stdin(&mut self) -> Option<&mut dyn Write>;
    fn stdout(&mut self) -> Option<&mut dyn Read>;
    fn stderr(&mut self) -> Option<&mut dyn Read>;
    fn try_wait(&mut self) -> Result<Option<ExitStatus>, Self::Error>;
    fn wait(&mut self) -> Result<ExitStatus, Self::Error>;
    fn kill(&mut self) -> Result<(), Self::Error>;

    // Provided methods
    fn take_stdin(&mut self) -> Option<Box<dyn Write + Send>> { ... }
    fn take_stdout(&mut self) -> Option<Box<dyn Read + Send>> { ... }
    fn take_stderr(&mut self) -> Option<Box<dyn Read + Send>> { ... }
}
Expand description

Common lifecycle operations for one native sandbox instance.

Required Associated Types§

Source

type Error: Error + 'static

The native lifecycle error type.

Required Methods§

Source

fn id(&self) -> u32

The native process or boundary identifier.

Source

fn stdin(&mut self) -> Option<&mut dyn Write>

Returns the piped standard input stream, if requested.

Source

fn stdout(&mut self) -> Option<&mut dyn Read>

Returns the piped standard output stream, if requested.

Source

fn stderr(&mut self) -> Option<&mut dyn Read>

Returns the piped standard error stream, if requested.

Source

fn try_wait(&mut self) -> Result<Option<ExitStatus>, Self::Error>

Checks for completion without waiting for the command.

Source

fn wait(&mut self) -> Result<ExitStatus, Self::Error>

Waits for completion while enforcing the prepared timeout policy.

Source

fn kill(&mut self) -> Result<(), Self::Error>

Terminates and confirms the complete sandbox boundary.

Provided Methods§

Source

fn take_stdin(&mut self) -> Option<Box<dyn Write + Send>>

Takes ownership of the piped standard input stream, when supported.

This is used by adapters that must perform blocking stream I/O without holding the child lifecycle lock. The default keeps existing custom backends source-compatible; such adapters expose no detachable stream through that integration path.

Source

fn take_stdout(&mut self) -> Option<Box<dyn Read + Send>>

Takes ownership of the piped standard output stream, when supported.

Source

fn take_stderr(&mut self) -> Option<Box<dyn Read + Send>>

Takes ownership of the piped standard error stream, when supported.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§