usb-device
usb-device copied to clipboard
Replace custom UsbError::WouldBlock with nb implementation
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.