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§
Sourcefn new(header_len: usize) -> Self
fn new(header_len: usize) -> Self
Creates a new Bytes instance.
It must always have header len available and initialized
Sourcefn header_mut(&mut self) -> BytesMut<'_>
fn header_mut(&mut self) -> BytesMut<'_>
Returns the header mutably.
Sourcefn full_header_mut(&mut self) -> BytesMut<'_>
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
.
Sourcefn body_mut(&mut self) -> BodyBytesMut<'_>
fn body_mut(&mut self) -> BodyBytesMut<'_>
Returns the body mutably.
Sourcefn full_body_mut(&mut self) -> BytesMut<'_>
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.