Skip to main content

ProcessPort

Trait ProcessPort 

Source
pub trait ProcessPort: Send + Sync {
    // Required methods
    fn spawn<'life0, 'life1, 'async_trait>(
        &'life0 self,
        spec: &'life1 ProcessSpawnSpec,
    ) -> Pin<Box<dyn Future<Output = Result<ProcessHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        handle: &'life1 ProcessHandle,
    ) -> Pin<Box<dyn Future<Output = Result<ProcessState>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn wait_with_timeout<'life0, 'life1, 'async_trait>(
        &'life0 self,
        handle: &'life1 ProcessHandle,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<ProcessState>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn kill_group<'life0, 'life1, 'async_trait>(
        &'life0 self,
        handle: &'life1 ProcessHandle,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

General managed-subprocess port: spawn in a process group, poll status, wait with timeout (killing the group on expiry), and explicit group kill.

Required Methods§

Source

fn spawn<'life0, 'life1, 'async_trait>( &'life0 self, spec: &'life1 ProcessSpawnSpec, ) -> Pin<Box<dyn Future<Output = Result<ProcessHandle>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Spawn spec in its own process group and return a handle + pid.

Source

fn status<'life0, 'life1, 'async_trait>( &'life0 self, handle: &'life1 ProcessHandle, ) -> Pin<Box<dyn Future<Output = Result<ProcessState>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Poll the current state without blocking for exit.

Source

fn wait_with_timeout<'life0, 'life1, 'async_trait>( &'life0 self, handle: &'life1 ProcessHandle, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<ProcessState>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Wait up to timeout for exit. On timeout the whole process group is killed and ProcessState::Exited with code: None is returned.

Source

fn kill_group<'life0, 'life1, 'async_trait>( &'life0 self, handle: &'life1 ProcessHandle, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Kill the managed process group immediately.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§