Struct voncount::WriteCounter[][src]

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

Wraps any implementation of std::io::Write and counts the bytes written.

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

Trait Implementations

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

Important traits for WriteCounter<'a, T>

Creates a WriteCounter by wrapping any implementation of std::io::Write.

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

impl<'a, T: 'a + Write> Counter for WriteCounter<'a, T>
[src]

Returns the number of bytes written so far.

impl<'a, T: 'a + Write> Write for WriteCounter<'a, T>
[src]

Proxies to the inner write function, counting the bytes written along the way.

Panics

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

Errors

This function will error only if the underlying function errors.

Proxies to the inner flush function.

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

Auto Trait Implementations

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

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