Struct voncount::ReadCounter[][src]

pub struct ReadCounter<'a, T: 'a + Read> { /* fields omitted */ }

Wraps any implementation of std::io::Read and counts the bytes read.

A ReadCounter instance wraps any implementation of std::io::Read. Since ReadCounter also implements std::io::Read you can use it in place of the other implementation. The ReadCounter will count the number of bytes read.

Trait Implementations

impl<'a, T: 'a + Read> From<&'a mut T> for ReadCounter<'a, T>
[src]

Important traits for ReadCounter<'a, T>

Creates a ReadCounter by wrapping any implementation of std::io::Read.

The lifetime of this instance cannot be greater than the lifetime of the wrapped instance.

impl<'a, T: 'a + Read> Counter for ReadCounter<'a, T>
[src]

Returns the number of bytes read so far.

impl<'a, T: 'a + Read> Read for ReadCounter<'a, T>
[src]

Proxies to the inner read function, counting the bytes read along the way.

Panics

  1. When the underlying function panics.
  2. If more than usize::max_value() bytes are read across all calls to read.

Errors

This function will error only if the underlying function errors.

🔬 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

Deprecated since 1.27.0

: Use str::from_utf8 instead: https://doc.rust-lang.org/nightly/std/str/struct.Utf8Error.html#examples

🔬 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 [char]s. 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

Auto Trait Implementations

impl<'a, T> Send for ReadCounter<'a, T> where
    T: Send

impl<'a, T> Sync for ReadCounter<'a, T> where
    T: Sync