Trait VectoredRead

Source
pub trait VectoredRead: Sized {
    // Required method
    fn read_vectored<const E: bool>(
        curs: &mut VectoredCursor<'_>,
    ) -> Result<Self, WireError>;
}
Expand description

Deserialization to an owned data type from the vectored wire.

A type that implements this trait guarantees that it can be constructed using a number of bytes from the provided VectoredCursor. If the bytes contained on the vectored wire would lead to the construction of an invalid instance of the object, an error will be returned instead of the object.

Required Methods§

Source

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Consumes a number of bytes from curs and returns an owned instance of the specified type, or returns a WireError on failure.

The generic boolean E designates the intended endianness of the data being read. If E is set to true, then the data will be deserialized in big endian format; if false, it will be deserialized in little endian.

§Errors

WireError::InsufficientBytes - not enough bytes remained on the vectored cursor to construct the type.

WireError::InvalidData - the bytes retrieved from curs could not be used to construct a valid instance of the type.

WireError::Internal - an internal error occurred in the wire-rs library

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.

Implementations on Foreign Types§

Source§

impl VectoredRead for f32

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for f64

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for i8

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for i16

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for i32

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for i64

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for i128

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for isize

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for u8

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for u16

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for u32

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for u64

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for u128

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Source§

impl VectoredRead for usize

Source§

fn read_vectored<const E: bool>( curs: &mut VectoredCursor<'_>, ) -> Result<Self, WireError>

Implementors§