this post was submitted on 23 Mar 2025
13 points (100.0% liked)
Rust
6697 readers
102 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I've not looked too much into it, but it seems AsyncRead/AsyncBufRead (through IoSafe) is implemented for stdin. So i think you should be able to use it like that.
Yeah that looks fine, thanks! It would introduce a new dependency (
async_io
) though, so I might go withUnblock
mentioned above. Let's see what happens when I try to make the switch :)(e) Ah I don't think this really works, I'd need to wrap it in an
Async
, but the docs explicitely mention not to use that withStdin
: https://docs.rs/smol/latest/smol/struct.Async.html#supported-types.Unblock
it is then :)