Skip to main content

PipeReading

Trait PipeReading 

Source
pub trait PipeReading {
    // Required method
    fn pipe_reader<'scheduler>(
        &'scheduler self,
        pipe: OwnedFd,
    ) -> Result<impl PipeReader + 'scheduler + use<'scheduler, Self>>;
}
Expand description

Adopt the readable end of an existing Unix pipe, such as std::process::ChildStdout, ChildStderr or std::io::PipeReader, as a scheduler-bound sequential reader.

The factory takes exclusive ownership of the descriptor and sets O_NONBLOCK on its open file description. Pass a descriptor whose file description is not shared with code that expects blocking reads; the other end of a pipe is a separate description and is unaffected. Construction performs no payload I/O; backends may defer readiness registration until a read must wait. Anonymous pipes are supported on Linux and macOS. FIFOs are not: a peer reopening a FIFO after a hang-up is not guaranteed to restore readiness waits on every backend. Regular files are not supported: use FileReading for positioned and cursor I/O.

Required Methods§

Source

fn pipe_reader<'scheduler>( &'scheduler self, pipe: OwnedFd, ) -> Result<impl PipeReader + 'scheduler + use<'scheduler, Self>>

Take ownership of a pipe descriptor and return a reader bound to this scheduler. The handle closes the descriptor when it is closed or dropped. On error the descriptor is closed.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§