Skip to main content

BufParseInput

Trait BufParseInput 

Source
pub trait BufParseInput {
    type Error;

    // Required method
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>;
}
Expand description

A helper trait for stream input.

This trait is modeled on std’s Read, but is separate so it’s usable with no_std. When the std feature is enabled (it is by default), this trait has a blanket implementation for every type that implement std’s Read.

Required Associated Types§

Source

type Error

The error type returned by read operations.

Required Methods§

Source

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

Read bytes into the provided buffer, up to its length, and return the number of bytes read.

This function may read fewer bytes. If no more input is available, it should not modify the buffer and merely return 0.

Implementors§

Source§

impl<R: Read + ?Sized> BufParseInput for R

Available on crate feature std only.