Struct rabble::MsgpackSerializer
[−]
[src]
pub struct MsgpackSerializer<T: Encodable + Decodable + Debug + Clone> { /* fields omitted */ }
Trait Implementations
impl<T: Encodable + Decodable + Debug + Clone> Serialize for MsgpackSerializer<T>
[src]
type Msg = T
fn new() -> MsgpackSerializer<T>
fn read_msg<U: Read>(&mut self, reader: &mut U) -> Result<Option<T>>
Read and decode a single message at a time. Read more
fn write_msgs<U: Write>(&mut self,
writer: &mut U,
msg: Option<&T>)
-> Result<bool>
writer: &mut U,
msg: Option<&T>)
-> Result<bool>
Write out as much pending data as possible. Append msg
to the pending data if not None
. If this function returns Ok(false)
the writer is no longer writable (EAGAIN/EWOULDBLOCK) Read more
fn set_writable(&mut self)
As an optimization to prevent unnecessary write system calls, the serializer should keep track of whether the writer is writable or not. The serializer will automatically be set to unwritable if write_msgs
returns Ok(false)
. When the poller fires and lets us know that the writer is writable again, we should call this function to inform the serializer so that it will attempt to write to the writer and not just buffer the request. Read more
fn is_writable(&self) -> bool
Tell us whether or not the serializer believes the associated writer is writable or not.