Trait toku_protocol::frames::Frame [−][src]
pub trait Frame: Sized + 'static { const OPCODE: u8; const HEADER_SIZE_IN_BYTES: usize; fn put_header(&self, dst: &mut BytesMut); fn payload(self) -> Option<Vec<u8>>; fn read_payload_size(buf: &mut BytesMut) -> u32; fn from_buf(buf: &BytesMut) -> Result<Option<Self>, ProtocolError>; }
Associated Constants
const HEADER_SIZE_IN_BYTES: usize
const HEADER_SIZE_IN_BYTES: usize
Header size in bytes, including the payload size field.
Required methods
fn put_header(&self, dst: &mut BytesMut)
fn put_header(&self, dst: &mut BytesMut)
Put the header bytes into the destination buffer. Space is already reserved. Do not put the payload size, that will be handled for you based on what is returned by Frame::payload()
fn read_payload_size(buf: &mut BytesMut) -> u32
fn read_payload_size(buf: &mut BytesMut) -> u32
Read the payload size from the buffer.