pub trait PacketBytes: Debug {
    // Required methods
    fn new(header_len: usize) -> Self;
    fn header(&self) -> Bytes<'_>;
    fn header_mut(&mut self) -> BytesMut<'_>;
    fn full_header_mut(&mut self) -> BytesMut<'_>;
    fn body(&self) -> BodyBytes<'_>;
    fn body_mut(&mut self) -> BodyBytesMut<'_>;
    fn full_body_mut(&mut self) -> BytesMut<'_>;
}
Expand description

A trait that allows efficient allocation if encryption is used or not.

Required Methods§

source

fn new(header_len: usize) -> Self

Creates a new Bytes instance.

It must always have header len available and initialized

source

fn header(&self) -> Bytes<'_>

Returns the header Bytes.

source

fn header_mut(&mut self) -> BytesMut<'_>

Returns the header mutably.

source

fn full_header_mut(&mut self) -> BytesMut<'_>

Returns the full header mutably.

Note

This should only be used to fill the buffer from a reader, in any other case you should use header_mut.

source

fn body(&self) -> BodyBytes<'_>

Returns the body.

source

fn body_mut(&mut self) -> BodyBytesMut<'_>

Returns the body mutably.

source

fn full_body_mut(&mut self) -> BytesMut<'_>

Returns the full body mutably.

Note

This should only be used to fill the buffer from a reader, in any other case you should use body_mut.

Object Safety§

This trait is not object safe.

Implementors§