stdin-nonblocking 0.4.1

Dependency-less non-blocking stdin reader using background threads. Supports streaming and immediate fallback defaults.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::io::{self, Write};
use stdin_nonblocking::get_stdin_or_default;

// Used for integration testing
fn main() {
    let input = get_stdin_or_default(Some(b"fallback_value"));

    // Print raw binary data instead of Debug format
    io::stdout()
        .write_all(&input.unwrap())
        .expect("Failed to write output");
}