[][src]Struct abscissa_core::testing::prelude::Stdout

pub struct Stdout(_);

Buffered reader for standard output

Methods from Deref<Target = BufReader<ChildStdout>>

pub fn get_ref(&self) -> &R1.0.0[src]

Gets a reference to the underlying reader.

It is inadvisable to directly read from the underlying reader.

Examples

use std::io::BufReader;
use std::fs::File;

fn main() -> std::io::Result<()> {
    let f1 = File::open("log.txt")?;
    let reader = BufReader::new(f1);

    let f2 = reader.get_ref();
    Ok(())
}

pub fn get_mut(&mut self) -> &mut R1.0.0[src]

Gets a mutable reference to the underlying reader.

It is inadvisable to directly read from the underlying reader.

Examples

use std::io::BufReader;
use std::fs::File;

fn main() -> std::io::Result<()> {
    let f1 = File::open("log.txt")?;
    let mut reader = BufReader::new(f1);

    let f2 = reader.get_mut();
    Ok(())
}

pub fn buffer(&self) -> &[u8]1.37.0[src]

Returns a reference to the internally buffered data.

Unlike fill_buf, this will not attempt to fill the buffer if it is empty.

Examples

use std::io::{BufReader, BufRead};
use std::fs::File;

fn main() -> std::io::Result<()> {
    let f = File::open("log.txt")?;
    let mut reader = BufReader::new(f);
    assert!(reader.buffer().is_empty());

    if reader.fill_buf()?.len() > 0 {
        assert!(!reader.buffer().is_empty());
    }
    Ok(())
}

pub fn seek_relative(&mut self, offset: i64) -> Result<(), Error>[src]

🔬 This is a nightly-only experimental API. (bufreader_seek_relative)

Seeks relative to the current position. If the new position lies within the buffer, the buffer will not be flushed, allowing for more efficient seeks. This method does not return the location of the underlying reader, so the caller must track this information themselves if it is required.

Trait Implementations

impl OutputStream<ChildStdout> for Stdout[src]

fn expect_line(&mut self, expected_line: &str)[src]

Read a line and ensure it matches the expected value. Read more

fn expect_regex<T>(&mut self, regex: T) where
    T: Into<Regex>, 
[src]

Read a line and test it against the given regex. Read more

impl DerefMut for Stdout[src]

impl Deref for Stdout[src]

type Target = BufReader<ChildStdout>

The resulting type after dereferencing.

impl Debug for Stdout[src]

Auto Trait Implementations

impl Unpin for Stdout

impl Sync for Stdout

impl Send for Stdout

impl RefUnwindSafe for Stdout

impl UnwindSafe for Stdout

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]