Hello! I was wondering if there is interest in adding a trait for async drivers.
I am currently using an Rmt async driver for my smart leds and couldn't find support for it anywhere, so I rolled my own, and wanted to contribute back.
I am happy to provide a PR to enable those traits (perhaps with a feature flag) something like the following, or perhaps via a generic type, as esp-hal does it
#[cfg(feature = "async")]
pub trait SmartLedsWriteAsync {
type Error;
type Color;
async fn write<T, I>(&mut self, iterator: T) -> Result<(), Self::Error>
where
T: IntoIterator<Item = I>,
I: Into<Self::Color>;
}
I wouldn't be against it, but, to be honest, I have very little experience with async rust. Feel free to open a PR.
Since I don't have any idea about async, let me ask a few questions:
Is there a reason to hide it behind a feature flag? Could it lead to issues if enabled in some circumstances?
If both traits (the async and the non-async one) are in scope, could this lead to conflicts due to sharing the same name? Or is the context almost always enough to select the correct one? How do other crates with this.
Hello! I was wondering if there is interest in adding a trait for async drivers.
I am currently using an Rmt async driver for my smart leds and couldn't find support for it anywhere, so I rolled my own, and wanted to contribute back.
I am happy to provide a PR to enable those traits (perhaps with a feature flag) something like the following, or perhaps via a generic type, as esp-hal does it