Struct tk_bufstream::ReadBuf
[−]
[src]
pub struct ReadBuf<S> { pub in_buf: Buf, // some fields omitted }
An input counterpart of IoBuf when the latter is split
Fields
in_buf: Buf
Methods
impl<S> ReadBuf<S>
[src]
fn read(&mut self) -> Result<usize, Error> where
S: AsyncRead,
S: AsyncRead,
Read a chunk of data into a buffer
The data just read can then be found in self.in_buf
.
This method does just one read. Because you are ought to try parse request after every read rather than reading a lot of the data in memory.
This method returns 0
when no bytes are read, both when WouldBlock
occurred and when connection has been closed. You may then use
self.done()
to distinguish from these conditions.
Note: this method silently assumes that you will call it on poll every time until self.done() returns false. I.e. it behaves as Async method but does't return Async value to allow simpler handling
fn done(&self) -> bool
Returns true when connection is closed by peer
Note: this method returns false and schedules a wakeup if connecion is currently locked