basic_functions 0.1.0

Just a collection of functions that I might want to use in my projects
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Waits for keyboard input, mainly to stop a program from exiting before you want it to.
///
/// Source: [HeapUnderflow](https://gitlab.com/HeapUnderflow/vidgen/-/blob/57fc60af51dd5d6954aa82f0c9cc99cc63d7db6e/src/main.rs#L97)
pub fn await_user_input() {
    use std::io::{stdin, BufRead, BufReader};

    println!("Press [Enter] to exit.");

    let stdin = stdin();
    let mut read = BufReader::new(stdin.lock());

    let mut garbage = String::new();
    read.read_line(&mut garbage)
        .expect("failed to read any input from stdin");
}