bitcoin_io

Trait Read

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

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

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

Required Methods§

source

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

Reads bytes from source into buf.

Provided Methods§

source

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

Reads bytes from source until buf is full.

source

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

Creates an adapter which will read at most limit bytes.

source

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

Available on crate feature alloc only.

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Read for &File

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for &Stdin

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for &TcpStream

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for &UnixStream

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for &[u8]

source§

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

source§

impl Read for VecDeque<u8>

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for Arc<File>

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for File

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for Stdin

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for StdinLock<'_>

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for Empty

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for Repeat

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for TcpStream

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for UnixStream

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for ChildStderr

Available on crate feature std only.
source§

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

source§

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

source§

impl Read for ChildStdout

Available on crate feature std only.
source§

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

source§

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

source§

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

Available on crate feature std only.
source§

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

source§

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

source§

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

Available on crate feature std only.
source§

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

source§

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

source§

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

Available on crate feature std only.
source§

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

source§

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

source§

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

Available on crate feature std only.
source§

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

source§

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

source§

impl<T: Read> Read for &mut T

source§

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

source§

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

Implementors§

source§

impl<'a, R: Read + ?Sized> Read for bitcoin_io::Take<'a, R>

source§

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

source§

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

Available on crate feature std only.
source§

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

Available on crate feature std only.