.events() and .keys() not working after manually reading from stdin
Hello there, noob here.
I'm trying to read from stdin manually before using .events() and .keys() on std::io::Stdin.
My code:
let stdin = stdin();
// ...
let mut buffer = String::new();
match 0 {
0 => {
// reads successfully
let mut handle = stdin.lock();
stdin.read_to_string(&mut buffer).unwrap();
}
_ => {}
}
// ...
let handle = stdin.lock();
let mut events = handle.keys();
loop {
// always returns None!!!
let event = events.next();
}
events.next() always returns None. I don't know why it does not work. I hope I posted this in the right place.