Trait packet::Fragment

source ·
pub trait Fragment: ByteSlice {
    // Required methods
    fn take_front(&mut self, n: usize) -> Self;
    fn take_back(&mut self, n: usize) -> Self;
    fn empty() -> Self;
}
Expand description

A single byte slice fragment in a FragmentedByteSlice.

Required Methods§

source

fn take_front(&mut self, n: usize) -> Self

Takes n bytes from the front of this fragment.

After a call to take_front(n), the fragment is n bytes shorter.

§Panics

Panics if n is larger than the length of this ByteSlice.

source

fn take_back(&mut self, n: usize) -> Self

Takes n bytes from the back of this fragment.

After a call to take_back(n), the fragment is n bytes shorter.

§Panics

Panics if n is larger than the length of this ByteSlice.

source

fn empty() -> Self

Constructs a new empty Fragment.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> Fragment for &'a [u8]

source§

fn take_front(&mut self, n: usize) -> Self

source§

fn take_back(&mut self, n: usize) -> Self

source§

fn empty() -> Self

source§

impl<'a> Fragment for &'a mut [u8]

source§

fn take_front(&mut self, n: usize) -> Self

source§

fn take_back(&mut self, n: usize) -> Self

source§

fn empty() -> Self

Implementors§