Skip to main content

PrefixedRead

Trait PrefixedRead 

Source
pub trait PrefixedRead: Sized {
    // Required method
    fn read_prefixed_bound<P: TryInto<usize> + ReadFrom>(
        data: &mut Cursor<&[u8]>,
        bound: usize,
    ) -> Result<Self>;

    // Provided method
    fn read_prefixed<P: TryInto<usize> + ReadFrom>(
        data: &mut Cursor<&[u8]>,
    ) -> Result<Self> { ... }
}
Expand description

A trait for reading prefixed data from a cursor.

Required Methods§

Source

fn read_prefixed_bound<P: TryInto<usize> + ReadFrom>( data: &mut Cursor<&[u8]>, bound: usize, ) -> Result<Self>

Reads prefixed data from a cursor with a bound.

Provided Methods§

Source

fn read_prefixed<P: TryInto<usize> + ReadFrom>( data: &mut Cursor<&[u8]>, ) -> Result<Self>

Reads prefixed data from a cursor.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PrefixedRead for String

Source§

fn read_prefixed_bound<P: TryInto<usize> + ReadFrom>( data: &mut Cursor<&[u8]>, bound: usize, ) -> Result<Self>

Source§

impl<T: PrefixedRead> PrefixedRead for Option<T>

Source§

fn read_prefixed_bound<P: TryInto<usize> + ReadFrom>( data: &mut Cursor<&[u8]>, bound: usize, ) -> Result<Self>

Source§

impl<T: ReadFrom> PrefixedRead for Vec<T>

Source§

fn read_prefixed_bound<P: TryInto<usize> + ReadFrom>( data: &mut Cursor<&[u8]>, bound: usize, ) -> Result<Self>

Implementors§