Struct async_ringbuffer::Writer
[−]
[src]
pub struct Writer(_);
Write access to a nonblocking ring buffer with fixed capacity.
If there is no space in the buffer to write to, the current task is parked and notified once space becomes available.
Trait Implementations
impl Drop for Writer
[src]
impl Write for Writer
[src]
Nonblocking Write
implementation.
fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
[src]
Write data to the RingBuffer. The only error this may return is of kind
WouldBlock
. When this returns a WouldBlock
error, the current task
is parked and gets notified once more space becomes available in the
buffer.
This returns only returns Ok(0)
if either buf.len() == 0
, shutdown
has been called, or if the corresponding Reader has been dropped and no
more data will be read to free up space for new data. If the Writer task
is parked while the Reader is dropped, the task gets notified.
If a previous call to read
returned a WouldBlock
error, the
corresponding Reader
is unparked if data was written in this write
call.
fn flush(&mut self) -> Result<(), Error>
[src]
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[src]
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Write
. Read more
impl AsyncWrite for Writer
[src]
fn shutdown(&mut self) -> Poll<(), Error>
[src]
Once shutdown has been called, the corresponding reader will return
Ok(0)
on read
after all buffered data has been read. If the reader
is parked while this is called, it gets notified.
fn write_buf<B>(&mut self, buf: &mut B) -> Result<Async<usize>, Error> where
B: Buf,
[src]
B: Buf,
Write a Buf
into this value, returning how many bytes were written. Read more