netstack3_core::tcp

Trait SendBuffer

Source
pub trait SendBuffer: Buffer {
    type Payload<'a>: InnerPacketBuilder + Payload + Debug + 'a;

    // Required methods
    fn mark_read(&mut self, count: usize);
    fn peek_with<'a, F, R>(&'a mut self, offset: usize, f: F) -> R
       where F: FnOnce(Self::Payload<'a>) -> R;
}
Expand description

A buffer supporting TCP sending operations.

Required Associated Types§

Source

type Payload<'a>: InnerPacketBuilder + Payload + Debug + 'a

The payload type given to peek_with.

Required Methods§

Source

fn mark_read(&mut self, count: usize)

Removes count bytes from the beginning of the buffer as already read.

§Panics

Panics if more bytes are marked as read than are available, i.e., count > self.len.

Source

fn peek_with<'a, F, R>(&'a mut self, offset: usize, f: F) -> R
where F: FnOnce(Self::Payload<'a>) -> R,

Calls f with contiguous sequences of readable bytes in the buffer without advancing the reading pointer.

§Panics

Panics if more bytes are peeked than are available, i.e., offset > self.len

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.

Implementors§