Read

Trait Read 

Source
pub trait Read<'read>: Sized + Debug {
    type Error: Sized + Copy + Debug;

    // Required methods
    fn read_byte(&mut self) -> Result<u8, Self::Error>;
    fn read_exact(&mut self, slice: &mut [u8]) -> Result<(), Self::Error>;
}
Expand description

A no-std io::Read alternative.

While plenty of crates define their own, we avoid external dependencies by once again defining our own. For those who wish to use embedded-io, please see core-json-embedded-io.

Required Associated Types§

Source

type Error: Sized + Copy + Debug

The type for errors when interacting with this reader.

Required Methods§

Source

fn read_byte(&mut self) -> Result<u8, Self::Error>

Read a single byte from the reader.

Source

fn read_exact(&mut self, slice: &mut [u8]) -> Result<(), Self::Error>

Read into a slice from the reader.

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<'read> Read<'read> for &'read [u8]

Source§

type Error = SliceError

Source§

fn read_byte(&mut self) -> Result<u8, Self::Error>

Source§

fn read_exact(&mut self, slice: &mut [u8]) -> Result<(), Self::Error>

Source§

impl<'read, R: Read<'read>> Read<'read> for &mut R

Source§

type Error = <R as Read<'read>>::Error

Source§

fn read_byte(&mut self) -> Result<u8, Self::Error>

Source§

fn read_exact(&mut self, slice: &mut [u8]) -> Result<(), Self::Error>

Implementors§