Skip to content

Commit 369d963

Browse files
committed
Don't require UsbBus to be Sync.
If the UsbBus is not Sync, it can still be used to make a UsbDevice, but that UsbDevice will not be Sync. This is quite limiting (as it mostly means that the USB device can't be accessed from interrupt contexts), but it is entirely safe from the Rust safety perspective.
1 parent 4a10d59 commit 369d963

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1515

1616
* [breaking] The control pipe is now provided in the `UsbDeviceBuilder` API to allow for user-provided control
1717
pipes. This makes it so that control pipes have configurable sizing.
18+
* Don't require UsbBus to be Sync. If a UsbBus is not Sync, it can still be used to make a UsbDevice, but that UsbDevice will not be Sync (ensuring soundness).
1819

1920
## [0.3.2] - 2024-03-06
2021

src/bus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use portable_atomic::{AtomicPtr, Ordering};
1717
/// take place before [`enable`](UsbBus::enable) is called. After the bus is enabled, in practice
1818
/// most access won't mutate the object itself but only endpoint-specific registers and buffers, the
1919
/// access to which is mostly arbitrated by endpoint handles.
20-
pub trait UsbBus: Sync + Sized {
20+
pub trait UsbBus: Sized {
2121
/// Allocates an endpoint and specified endpoint parameters. This method is called by the device
2222
/// and class implementations to allocate endpoints, and can only be called before
2323
/// [`enable`](UsbBus::enable) is called.

0 commit comments

Comments
 (0)