[][src]Struct bufstream::BufStream

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]

Important traits for BufStream<S>

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

Important traits for BufStream<S>

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]

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

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

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

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

Determines if this Reader can work with buffers of uninitialized memory. 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

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

Transforms this Read instance to an [Iterator] over its bytes. 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> BufRead for BufStream<S>
[src]

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

Auto Trait Implementations

impl<S> Send for BufStream<S> where
    S: Send

impl<S> Sync for BufStream<S> where
    S: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]