Expand description

Library giving an easy way to fetch input from the standard input through the exported input macro.


use catch_input::input;
fn main() {
    let input_a = input!("What's your favorite food? ");
    let input_b = input!(|| { print!("What's your favorite drink? ") });
    assert!(input_a, String::from("Oatmeal"));
    assert!(input_b, String::from("Water"));
    // $ cargo run
    // What's your favorite food? Oatmeal
    // What's your favorite drink? Water


Macro that returns a trimmed String containing the user input from standard input. You may pass an argument to be used as a prompt, you may use a FnOnce or a type with the [Display] trait implemented.