pub trait Payload: PayloadLen + Sized {
// Required methods
fn slice(self, range: Range<u32>) -> Self;
fn partial_copy(&self, offset: usize, dst: &mut [u8]);
fn partial_copy_uninit(&self, offset: usize, dst: &mut [MaybeUninit<u8>]);
fn new_empty() -> Self;
}
Expand description
A TCP payload that operates around u32
instead of usize
.
Required Methods§
Sourcefn slice(self, range: Range<u32>) -> Self
fn slice(self, range: Range<u32>) -> Self
Creates a slice of the payload, reducing it to only the bytes within
range
.
§Panics
Panics if the provided range
is not within the bounds of this
Payload
, or if the range is nonsensical (the end precedes
the start).
Sourcefn partial_copy(&self, offset: usize, dst: &mut [u8])
fn partial_copy(&self, offset: usize, dst: &mut [u8])
Copies part of the payload beginning at offset
into dst
.
§Panics
Panics if offset is too large or we couldn’t fill the dst
slice.
Sourcefn partial_copy_uninit(&self, offset: usize, dst: &mut [MaybeUninit<u8>])
fn partial_copy_uninit(&self, offset: usize, dst: &mut [MaybeUninit<u8>])
Copies part of the payload beginning at offset
into dst
.
§Panics
Panics if offset is too large or we couldn’t fill the dst
slice.
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.