netstack3_core::tcp

Trait Payload

Source
pub trait Payload: Sized + PayloadLen {
    // 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.

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.

Implementations on Foreign Types§

Source§

impl Payload for &[u8]

Source§

fn slice(self, _: Range<u32>) -> &[u8]

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() -> &[u8]

Source§

impl Payload for ()

Source§

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

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

Implementors§

Source§

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