Read chars from terminal (non-blocking)


#1

Hi, I’m porting some old 80’s BASIC code from SpaceGames book (usborne) to Rust.
So far so good, but now I have to implement the inkey function. It basically checks if there is something in stdin buffer and returns right away. I already implemented it in Python using select, but in Rust I used epoll.

You can see a snippet here:

But I think it got too complex. Any hints on how to improve this function?

Best Regards,

Nilo Menezes