bdk_chain::bitcoin::io

Trait Read

pub trait Read {
    // Required method
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>;

    // Provided methods
    fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> { ... }
    fn take(&mut self, limit: u64) -> Take<'_, Self> { ... }
    fn read_to_limit(
        &mut self,
        buf: &mut Vec<u8>,
        limit: u64,
    ) -> Result<usize, Error> { ... }
}
Expand description

A generic trait describing an input stream. See std::io::Read for more info.

Required Methods§

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

Reads bytes from source into buf.

Provided Methods§

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

Reads bytes from source until buf is full.

fn take(&mut self, limit: u64) -> Take<'_, Self>

Creates an adapter which will read at most limit bytes.

fn read_to_limit( &mut self, buf: &mut Vec<u8>, limit: u64, ) -> Result<usize, Error>

Attempts to read up to limit bytes from the reader, allocating space in buf as needed.

limit is used to prevent a denial of service attack vector since an unbounded reader will exhaust all memory.

Similar to std::io::Read::read_to_end but with the DOS protection.

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§

§

impl Read for &File

§

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

§

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

§

impl Read for &Stdin

§

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

§

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

§

impl Read for &TcpStream

§

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

§

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

§

impl Read for &UnixStream

§

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

§

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

§

impl Read for &[u8]

§

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

§

impl Read for VecDeque<u8>

§

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

§

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

§

impl Read for Arc<File>

§

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

§

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

§

impl Read for File

§

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

§

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

§

impl Read for Stdin

§

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

§

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

§

impl Read for StdinLock<'_>

§

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

§

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

§

impl Read for Empty

§

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

§

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

§

impl Read for Repeat

§

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

§

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

§

impl Read for TcpStream

§

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

§

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

§

impl Read for UnixStream

§

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

§

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

§

impl Read for ChildStderr

§

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

§

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

§

impl Read for ChildStdout

§

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

§

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

§

impl<R1, R2> Read for Chain<R1, R2>
where R1: Read, R2: Read,

§

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

§

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

§

impl<R> Read for BufReader<R>
where R: Read + ?Sized,

§

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

§

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

§

impl<R> Read for Take<R>
where R: Read,

§

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

§

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

§

impl<T> Read for Cursor<T>
where T: AsRef<[u8]>,

§

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

§

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

Implementors§

§

impl<'a, R> Read for bdk_chain::bitcoin::io::Take<'a, R>
where R: Read + ?Sized,

§

impl<T> Read for bdk_chain::bitcoin::io::Cursor<T>
where T: AsRef<[u8]>,

§

impl<T> Read for FromStd<T>
where T: Read,

§

impl<T> Read for ToStd<T>
where T: Read,