Skip to main content

Read

Trait Read 

Source
pub trait Read {
    type Chunk: SplitByteSlice;

    // Required methods
    fn next_chunk(&mut self) -> ParseResult<Self::Chunk>;
    fn chunks_len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

An iterator over contiguous byte slices which can be parsed as a packet.

Required Associated Types§

Source

type Chunk: SplitByteSlice

The type of each byte slice.

Required Methods§

Source

fn next_chunk(&mut self) -> ParseResult<Self::Chunk>

Attempts to fetch the next available byte slice from self.

Source

fn chunks_len(&self) -> usize

Returns the number of segments remaining.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns whether there are any segments remaining.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> Read for Iter<'a, Vec<u8>>

Available on crate feature alloc only.
Source§

type Chunk = &'a [u8]

Source§

fn next_chunk(&mut self) -> ParseResult<Self::Chunk>

Source§

fn chunks_len(&self) -> usize

Source§

impl<'a> Read for IterMut<'a, Vec<u8>>

Available on crate feature alloc only.
Source§

type Chunk = &'a mut [u8]

Source§

fn next_chunk(&mut self) -> ParseResult<Self::Chunk>

Source§

fn chunks_len(&self) -> usize

Implementors§