embedded-hal
embedded-hal copied to clipboard
Add `timeout_{us, ms}` to `embedded_hal_async::DelayUs`
trafficstars
Use cases where one wishes to select between a DelayUs::delay_us and a different Future are likely to be quite common.
I propose that we add something like async fn timeout_{us, ms}<F: Future>(timeout: u32, f: F) -> Result<F::Output, TimeoutError> to the DelayUs trait, with a default impl that falls back to a futures::select between self.timeout_{us, ms}() and f.