I write a piece of code like this.
use std::io::stdin;
fn main(){
let mut buf = String::new();
print!("Please enter your name:");
stdin().read_line(&mut buf).expect("Failed to read");
println!();
print!("{}",buf);
}
What do I expected is like
Please enter your name:John Doe
John Doe
But the actual is like
John Doe
Please enter your name:John Doe
Is there any way to realize the effect that I expected in Rust?(crates are ok,too)