Struct amy::FrameWriter
[−]
[src]
pub struct FrameWriter { /* fields omitted */ }
Abstraction for writing frame buffered data to non-blocking sockets.
Note that an individual frame writer should only write to one socket, since it tracks whether or not the socket is writable directly.
Methods
impl FrameWriter
[src]
pub fn new() -> FrameWriter
[src]
pub fn write<T: Write>(
&mut self,
writer: &mut T,
data: Option<Vec<u8>>
) -> Result<bool>
[src]
&mut self,
writer: &mut T,
data: Option<Vec<u8>>
) -> Result<bool>
Write as much possible stored data to the writer, along with optional new data.
If data is not None
, compute it's header and put it on the front of the pending list
followed by the data, as long as the writer isn't empty. If the writer is empty, compute the
header, put it in current and push the data onto the pending list.
Returns Ok(true)
if the socket is still writable, and Ok(false)
if it's not writable and
needs to be re-registered. Returns any io::Error except for EAGAIN
or EWOULDBLOCK
which
results in OK(false)
.
pub fn writable(&mut self)
[src]
Tell the frame writer that the corresponding writer is writable again.