Open
Description
The I2c
trait from embedded-hal-async
would allow this crate's usage with embassy
.
Unfortunately, I can only think of hacky solutions to support both blocking and async:
- Make a second copy of all the functions, doing the rote
fn
->async fn
transformation and sprinkling in some.await
calls - Macro magic to define two copies using the same source
and then another question is:
- Keep the same type names and swap in
async
using a feature, or - Expose the methods on a different type or in a different module (still feature-gated).
I asked in rust-embedded/embedded-hal#356 if there's any best practice here. I think most of the other crates I've seen have gone for some form of duplicate code.
Metadata
Metadata
Assignees
Labels
No labels