From f871911c6d8516cbc4e8ddf2e0c6d5df067b6cb9 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Mon, 20 Apr 2020 01:13:56 +0800 Subject: [PATCH] add input.rs --- single_file_tests/input.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 single_file_tests/input.rs diff --git a/single_file_tests/input.rs b/single_file_tests/input.rs new file mode 100644 index 0000000..db927c3 --- /dev/null +++ b/single_file_tests/input.rs @@ -0,0 +1,11 @@ +use std::{ io, error::Error, }; +fn main() -> Result<(), Box> { + let mut input = String::new(); + + println!("Please input: "); + io::stdin().read_line(&mut input)?; + + println!("You typed: {}", input.trim()); + + Ok(()) +}