pub trait ReadWritePipe: Write {
// Provided method
fn write_reader<R: Read>(&mut self, r: R) -> Result<usize> { ... }
}
Expand description
A trait for objects implementing Write
, to write all content from a Read
object.
This trait adds one method to the writers implementing it.
write_reader
This method allows to read a whole reader object into the writer. There is no garantee about the state of both reader and writer in case of an error.
use std::io;
use read_write_pipe::*;
let _ = io::stdout().write_reader(io::stdin()).unwrap();
Provided Methods§
Sourcefn write_reader<R: Read>(&mut self, r: R) -> Result<usize>
fn write_reader<R: Read>(&mut self, r: R) -> Result<usize>
Examples found in repository?
More examples
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.