Struct io_streams::StreamDuplexer[][src]

pub struct StreamDuplexer { /* fields omitted */ }
Expand description

An unbuffered and unlocked interactive combination input and output stream, implementing Read and Write.

This may hold two file descriptors, one for reading and one for writing, such as stdin and stdout, or it may hold one file handle for both reading and writing, such as for a TCP socket.

There is no file constructor, even though File implements both Read and Write, because normal files are not interactive. However, there is a char_device constructor for character device files.

Implementations

Duplex with stdin and stdout, taking ownership of them.

Unlike std::io::stdin and std::io::stdout, this stdin_stdout returns a stream which is unbuffered and unlocked.

This acquires a std::io::StdinLock and a std::io::StdoutLock (in non-recursive ways) to prevent accesses to std::io::Stdin and std::io::Stdout while this is live, and fails if a StreamReader for standard input, a StreamWriter for standard output, or a StreamDuplexer for standard input and standard output already exist.

Duplex with an open TCP stream, taking ownership of it.

This method can be passed a std::net::TcpStream or similar TcpStream types.

Duplex with a pair of pipe streams, taking ownership of them.

Spawn the given command and duplex with its standard input and output.

Duplex with a child process’ stdout and stdin, taking ownership of them.

Read and write with the null device, which ignores all data, and produces no data.

Trait Implementations

Extracts the raw handle or socket for reading. Read more

Extracts the raw handle or socket for writing. Read more

Extracts the handle or socket for reading. Read more

Extracts the handle or socket for writing. Read more

Formats the value using the given formatter. Read more

Reads data from a stream without consuming it; subsequent reads will re-read the data. May return fewer bytes than requested; Ok(0) indicates that seeking is not possible (but reading may still be). Read more

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Like read, except that it reads into a slice of buffers. Read more

🔬 This is a nightly-only experimental API. (can_vector)

Determines if this Reader has an efficient read_vectored implementation. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Read the exact number of bytes required to fill buf. Read more

🔬 This is a nightly-only experimental API. (read_initializer)

Determines if this Reader can work with buffers of uninitialized memory. Read more

Creates a “by reference” adapter for this instance of Read. Read more

Transforms this Read instance to an Iterator over its bytes. Read more

Creates an adapter which will chain this stream with another. Read more

Creates an adapter which will read at most limit bytes from it. Read more

Return the number of bytes which are ready to be read immediately.

Write a buffer into this writer, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Like write, except that it writes from a slice of buffers. Read more

🔬 This is a nightly-only experimental API. (can_vector)

Determines if this Writer has an efficient write_vectored implementation. Read more

Attempts to write an entire buffer into this writer. Read more

🔬 This is a nightly-only experimental API. (write_all_vectored)

Attempts to write multiple buffers into this writer. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a “by reference” adapter for this instance of Write. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Extracts the grip for reading. Read more

Extracts the grip for writing. Read more

Extracts the grip for reading. Read more

Extracts the grip for writing. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Query the “status” flags for the self file descriptor.

Create a new SetFdFlags value for use with set_fd_flags. Read more

Set the “status” flags for the self file descriptor. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.