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]
impl<'a, T: 'a + Write> From<&'a mut T> for WriteCounter<'a, T>
ⓘImportant traits for WriteCounter<'a, T>fn from(value: &'a mut T) -> WriteCounter<'a, T>
[src]
fn from(value: &'a mut T) -> 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]
impl<'a, T: 'a + Write> Counter for WriteCounter<'a, T>
impl<'a, T: 'a + Write> Write for WriteCounter<'a, T>
[src]
impl<'a, T: 'a + Write> Write for WriteCounter<'a, T>
fn write(&mut self, buffer: &[u8]) -> Result<usize, Error>
[src]
fn write(&mut self, buffer: &[u8]) -> Result<usize, Error>
Proxies to the inner write
function, counting the bytes written along the way.
Panics
- When the underlying function panics.
- If more than
usize::max_value()
bytes are written across all calls towrite
.
Errors
This function will error only if the underlying function errors.
fn flush(&mut self) -> Result<(), Error>
[src]
fn flush(&mut self) -> Result<(), Error>
Proxies to the inner flush
function.
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
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> Send for WriteCounter<'a, T> where
T: Send,
impl<'a, T> Sync for WriteCounter<'a, T> where
T: Sync,
impl<'a, T> Sync for WriteCounter<'a, T> where
T: Sync,