| Crates.io | catch-input |
| lib.rs | catch-input |
| version | 1.1.2 |
| created_at | 2022-04-10 02:31:14.573087+00 |
| updated_at | 2022-04-11 03:14:00.015484+00 |
| description | Library implementing a macro for retrieving user input from the console. |
| homepage | |
| repository | https://github.com/c1m50c/catch-input |
| max_upload_size | |
| id | 564947 |
| size | 6,513 |
Rust library implementing a macro for retrieving user input from the console.
use catch_input::input;
fn main() {
let a = input!("PromptA => ");
let b = input!(|| { print!("PromptB => ") });
let c = input!((String::from("PromptC => ")));
assert!(a, String::from("Catch"));
assert!(b, String::from("Input"));
assert!(c, String::from("Crate"));
println!(">> {} : {} : {}", a, b, c);
}
$ cargo run
...
PromptA => Catch
PromptB => Input
PromptC => Crate
>> Catch : Input : Crate