Trait netstack3_base::Payload

source ·
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§

source

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

source

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.

source

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.

source

fn new_empty() -> Self

Creates a new empty payload.

An empty payload must report 0 as its length.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Payload for &[u8]

source§

fn slice(self, _: Range<u32>) -> Self

source§

fn partial_copy(&self, offset: usize, dst: &mut [u8])

source§

fn partial_copy_uninit(&self, offset: usize, dst: &mut [MaybeUninit<u8>])

source§

fn new_empty() -> Self

source§

impl Payload for ()

source§

fn slice(self, _: Range<u32>) -> Self

source§

fn partial_copy(&self, offset: usize, dst: &mut [u8])

source§

fn partial_copy_uninit(&self, offset: usize, dst: &mut [MaybeUninit<u8>])

source§

fn new_empty() -> Self

Implementors§

source§

impl<'a, const N: usize> Payload for FragmentedPayload<'a, N>