embedded_io_adapters::unblock::Unblock: adapter from embedded_io::{Read, Write} to embedded_io_async::{Read, Write}#652
Conversation
|
Turns out this can also be done with |
|
when |
|
@dess83-maker For anyone who came here tryng to turn a blocking stdin reader into an async reader in a std+embassy environment: I think that a cleaner approach is to just write a blocking parser and then spawn a thread to dump the messages on a channel. See this code as an example: It means that you end up with an awkward mix of blocking and async parsers dotted around your codebase, but I think it's fine. |
Funny story: I burned a bunch of time writing this because I couldn't get embassy's examples/std/src/bin/serial.rs working. I assumed that there was some problem with their serial port adapter or something because it was never returning any data. It turns out my USB UART adapter has a developed broken RX, so this was a bit pointless 😢. I thought I'd share it anyway.
I'm not sure how useful it will be to people:
If anything, its main usefulness would probably be to point people towards
async_io::Async, and give people a good chuckle at my expense. Feel free to close this PR if you don't think that it is useful. I'm also happy to re-work it, if you think it could be useful but just has the wrong shape.