Struct std::old_io::pipe::PipeStreamUnstable
[-] [+]
[src]
pub struct PipeStream { // some fields omitted }
A synchronous, in-memory pipe.
Methods
impl PipeStream
fn open(fd: c_int) -> IoResult<PipeStream>
Consumes a file descriptor to return a pipe stream that will have synchronous, but non-blocking reads/writes. This is useful if the file descriptor is acquired via means other than the standard methods.
This operation consumes ownership of the file descriptor and it will be closed once the object is deallocated.
Example
#![allow(unused_must_use)] extern crate libc; use std::old_io::pipe::PipeStream; fn main() { let mut pipe = PipeStream::open(libc::STDERR_FILENO); pipe.write(b"Hello, stderr!"); }extern crate libc; use std::old_io::pipe::PipeStream; fn main() { let mut pipe = PipeStream::open(libc::STDERR_FILENO); pipe.write(b"Hello, stderr!"); }
fn pair() -> IoResult<PipePair>
Creates a pair of in-memory OS pipes for a unidirectional communication stream.
The structure returned contains a reader and writer I/O object. Data written to the writer can be read from the reader.
Errors
This function can fail to succeed if the underlying OS has run out of available resources to allocate a new pipe.