Struct bufstream::BufStream [] [src]

pub struct BufStream<S: Write> { /* fields omitted */ }

Wraps a Stream and buffers input and output to and from it.

It can be excessively inefficient to work directly with a Read+Write. For example, every call to read or write on TcpStream results in a system call. A BufStream keeps in memory buffers of data, making large, infrequent calls to read and write on the underlying Read+Write.

The output buffer will be written out when this stream is dropped.

Methods

impl<S: Read + Write> BufStream<S>
[src]

Creates a new buffered stream with explicitly listed capacities for the reader/writer buffer.

Creates a new buffered stream with the default reader/writer buffer capacities.

Gets a reference to the underlying stream.

Gets a mutable reference to the underlying stream.

Warning

It is inadvisable to read directly from or write directly to the underlying stream.

Unwraps this BufStream, returning the underlying stream.

The internal write buffer is written out before returning the stream. Any leftover data in the read buffer is lost.

Trait Implementations

impl<S: Debug + Write> Debug for BufStream<S>
[src]

Formats the value using the given formatter.

impl<S: Read + Write> BufRead for BufStream<S>
[src]

Fills the internal buffer of this object, returning the buffer contents. Read more

Tells this buffer that amt bytes have been consumed from the buffer, so they should no longer be returned in calls to read. Read more

Read all bytes into buf until the delimiter byte or EOF is reached. Read more

Read all bytes until a newline (the 0xA byte) is reached, and append them to the provided buffer. Read more

Returns an iterator over the contents of this reader split on the byte byte. Read more

Returns an iterator over the lines of this reader. Read more

impl<S: Read + Write> Read for BufStream<S>
[src]

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

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

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

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

Creates a "by reference" adaptor for this instance of Read. Read more

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

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

the semantics of a partial read/write of where errors happen is currently unclear and may change

Transforms this Read instance to an Iterator over chars. Read more

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

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

impl<S: Read + Write> Write for BufStream<S>
[src]

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

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

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

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

Creates a "by reference" adaptor for this instance of Write. Read more