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

Opcode of the frame.

Header size in bytes, including the payload size field.

Required methods

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()

Return the payload bytes that should be encoded.

Read the payload size from the buffer.

Given a buf that is a complete frame, parse and return the Frame.

Implementors