Trait netstack3_core::tcp::Payload
source · pub trait Payload: Sized {
// Required methods
fn len(&self) -> usize;
fn slice(self, range: Range<u32>) -> Self;
fn partial_copy(&self, offset: usize, dst: &mut [u8]);
}
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.
Object Safety§
This trait is not object safe.