Hello,
I am reading from a character special file in Linux and I'd like to make the reads non-blocking. Is there an existing Rust way to do this?
Hello,
I am reading from a character special file in Linux and I'd like to make the reads non-blocking. Is there an existing Rust way to do this?
I don’t think there’s anything builtin, so to speak. But you can call into the appropriate libc functions, and then create a File from the raw fd: FromRawFd in std::os::unix::io - Rust
This is for sockets only and will error on Windows if it’s not a socket. So I wouldn’t say it’s portable .
Yeah, you're right of course.
I saw "nonblocking" and immediately thought "networking" without reading the question properly.
Sorry for the noise.