system_interface::io

Trait 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§