Trait netio::Stream [] [src]

pub trait Stream {
    fn by_ref(&mut self) -> &mut Self
    where
        Self: Sized
, { ... }
fn take(self, limit: u64) -> Take<Self>
    where
        Self: Sized
, { ... }
fn retry(self) -> Retry<Self>
    where
        Self: Sized
, { ... } }

Base trait for generic stream operations

Most of these function are generalizations of functions already present in std::io::Read and/or std::io::Write:

New methods without counterpart in std::io

  • retry

Provided Methods

Creates a "by reference" adaptor for this stream.

This method is equivalent to std::io::Read::by_ref and std::io::Write::by_ref

Creates an adapter which will limits the total number of bytes of this stream.

This function returns a new stream instance of which will read write at most limit bytes, after which it will always return EOF (Ok(0)). Any errors will not count towards the number of bytes read and future calls to read or write may succeed.

Differences to std::io::Read::take

This function is equivalent to std::io::Read::take except that the returned adapter implements BufReadGrow and std::io::Write if possible.

Transforms this stream into a stream that automatically retries on interrupts

The returned adapter will behave identically to the original stream, except that it retries all operations automatically if an error of kind ErrorKind::Interrupted occurs.

Note

Methods that are already expected to retry are forwarded directly to the underlying reader.

Implementors