usb-device icon indicating copy to clipboard operation
usb-device copied to clipboard

Replace custom UsbError::WouldBlock with nb implementation

Open DusterTheFirst opened this issue 2 years ago • 1 comments

The api of usb-device uses the UsbError::WouldBlock variant to signal that the current operation is waiting on the device. This is great for allowing non-blocking implementations of usb, but can be verbose to handle if the goal is to block on sending this data. The embedded HAL team has developed https://lib.rs/crates/nb which aims to standardize this behavior and comes with nice macros like block!() which simplify working with apis that use nb. The usb-device crate should adopt this standardized method to match what other crates in the embedded space do.

DusterTheFirst avatar Nov 17 '21 21:11 DusterTheFirst