To answer your question, There will be two parts to what you are trying to do[1]
First: since you are reading from a tty, you will need to put the tty in ‘non-canonical’ mode. By default TTY’s will only write out data on a new line. You can change that to stream data on new bytes, by putting the tty into non-canonical mode. man termios
has more information on what that means.
Second: There is a std.io.poll function, which will give you a poller on a file.
Here are some additional resources and references
- ztui-tabby: A TUI Keyboard Handling library
- libvaxis: A TUI library with keyboard handling functionality
- crossterm-rs: A rust library that has keyboard event handling code.
This is all for unix, I have no experience in how this would work on windows ↩︎