Skip to main content

SessionChild

Trait SessionChild 

Source
pub trait SessionChild {
    type Stdin: Write + Send + 'static;
    type Stdout: Read + Send + 'static;
    type Stderr: Read + Send + 'static;

    // Required methods
    fn take_stdin(&mut self) -> Option<Self::Stdin>;
    fn take_stdout(&mut self) -> Option<Self::Stdout>;
    fn take_stderr(&mut self) -> Option<Self::Stderr>;
    fn wait_session(&mut self) -> Result<SessionExit>;
}
Expand description

A spawned child the session pump can drive: the three raw stdio pipes plus a blocking wait that yields a SessionExit.

Implemented for a plain std::process::Child (the reference/client path, exercised by the pump’s own tests) and, in super::session_server, for the sanitized contained crate::spawn::SpawnedChild so the daemon can proxy a child confined to its own Job Object / process group. Keeping the pump generic over this trait is what lets one byte-transparent implementation serve both paths without the daemon side re-deriving the fidelity logic.

The stdio associated types are Send + 'static because the pump moves each into its own reader/writer thread.

Required Associated Types§

Source

type Stdin: Write + Send + 'static

Parent-side writer for the child’s stdin.

Source

type Stdout: Read + Send + 'static

Parent-side reader for the child’s stdout.

Source

type Stderr: Read + Send + 'static

Parent-side reader for the child’s stderr.

Required Methods§

Source

fn take_stdin(&mut self) -> Option<Self::Stdin>

Take the stdin writer. None if stdin was not piped or already taken.

Source

fn take_stdout(&mut self) -> Option<Self::Stdout>

Take the stdout reader. None if stdout was not piped or already taken.

Source

fn take_stderr(&mut self) -> Option<Self::Stderr>

Take the stderr reader. None if stderr was not piped or already taken.

Source

fn wait_session(&mut self) -> Result<SessionExit>

Block until the child exits and report its SessionExit.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl SessionChild for Child

Implementors§