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§

source

fn len(&self) -> usize

Returns the length of the payload.

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Payload for &[u8]

source§

fn len(&self) -> usize

source§

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

source§

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

source§

impl Payload for ()

source§

fn len(&self) -> usize

source§

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

source§

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

Implementors§