Trait system_interface::io::Peek

source ·
pub trait Peek {
    // Required method
    fn peek(&mut self, buf: &mut [u8]) -> Result<usize>;
}
Expand description

A trait providing the peek function for reading without consuming.

Many common Read implementations have Peek implementations, however Stdin, ChildStderr, ChildStdout, PipeReader, and CharDevice do not, since they are unbuffered and pipes and character devices don’t support any form of peeking.

Required Methods§

source

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

Reads data from a stream without consuming it; subsequent reads will re-read the data. May return fewer bytes than requested; Ok(0) indicates that seeking is not possible (but reading may still be).

Implementations on Foreign Types§

source§

impl Peek for File

source§

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

source§

impl Peek for Empty

source§

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

source§

impl Peek for Repeat

source§

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

source§

impl Peek for TcpStream

source§

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

source§

impl<'a> Peek for &'a [u8]

source§

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

source§

impl<'a> Peek for StdinLock<'a>

source§

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

source§

impl<'a, B: BufRead + ?Sized> Peek for &'a mut B

source§

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

source§

impl<B: BufRead + ?Sized> Peek for Box<B>

source§

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

source§

impl<R: Read> Peek for BufReader<R>

source§

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

source§

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

source§

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

source§

impl<T: BufRead> Peek for Take<T>

source§

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

source§

impl<T: BufRead, U: BufRead> Peek for Chain<T, U>

source§

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

Implementors§