PacketBytes

Trait PacketBytes 

Source
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl PacketBytes for EncryptedBytes

Available on crate feature encrypted only.
Source§

impl PacketBytes for PlainBytes