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 an open Unix-domain stream, taking ownership of it.
#[must_use]pub fn pipe_reader_writer(
pipe_reader: PipeReader,
pipe_writer: PipeWriter
) -> Self
[src]
#[must_use]pub fn pipe_reader_writer(
pipe_reader: PipeReader,
pipe_writer: PipeWriter
) -> Self
[src]Duplex with a pair of pipe streams, taking ownership of them.
Spawn the given command and duplex with its standard input and output.
#[must_use]pub fn child_stdout_stdin(
child_stdout: ChildStdout,
child_stdin: ChildStdin
) -> Self
[src]
#[must_use]pub fn child_stdout_stdin(
child_stdout: ChildStdout,
child_stdin: ChildStdin
) -> Self
[src]Duplex with a child process’ stdout and stdin, taking ownership of them.
Trait Implementations
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
can_vector
)Determines if this Read
er 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
read_initializer
)Determines if this Read
er can work with buffers of uninitialized
memory. Read more
Creates a “by reference” adaptor for this instance of Read
. Read more
Creates an adaptor which will chain this stream with another. 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
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
Attempts to write an entire buffer into this writer. Read more
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
Auto Trait Implementations
impl !RefUnwindSafe for StreamDuplexer
impl Send for StreamDuplexer
impl Sync for StreamDuplexer
impl Unpin for StreamDuplexer
impl !UnwindSafe for StreamDuplexer
Blanket Implementations
Extracts the unsafe handle for reading.
Extracts the unsafe handle for writing.
Mutably borrows from an owned value. Read more