Struct chomp::buffer::data_source::RWDataSource
[−]
[src]
pub struct RWDataSource<RW: Read + Write>(_);
Implementation of DataSource
for streams (e.g. network connections) that you can Read
and
Write
. It's really helpful to have the ability to write through the DataSource
and Source
objects, because once created, often they take full ownership of your input stream, and when
working with bidirectional connections you still need a way to write to them.
Methods
impl<RW: Read + Write> RWDataSource<RW>
[src]
fn new(inner: RW) -> Self
Creates a new RWDataSource
from a stream (e.g. network connection).
fn into_inner(self) -> RW
Consumes self to reveal the underlying stream.
Trait Implementations
impl<RW: Debug + Read + Write> Debug for RWDataSource<RW>
[src]
impl<RW: Read + Write> DataSource for RWDataSource<RW>
[src]
type Item = u8
The type of items this data source produces.
fn read(&mut self, buffer: &mut [u8]) -> Result<usize>
Populates the supplied buffer with data, returns the number of items written. Read more
impl<RW: Read + Write> Write for RWDataSource<RW>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Write
. Read more