feat: require Device to be Send+Sync#1221
Merged
Merged
Conversation
6e7d980 to
e9a3c79
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Promotes Send + Sync from per-backend compile-time assertions to first-class supertrait bounds on DeviceTrait and StreamTrait, so that downstream code can pass Devices and Streams across thread boundaries unconditionally. Wrapper bounds in host::custom are simplified accordingly, the per-backend assert_stream_send!/assert_stream_sync! invocations are removed, and the macros themselves are deprecated. The audioworklet backend gains its own unsafe impl Send/Sync for Stream to satisfy the new bound.
Changes:
- Add
Send + Syncsupertrait bounds toDeviceTraitandStreamTrait; deprecate the now-redundant assertion macros. - Drop redundant
Send + Syncconstraints fromhost::custom::{Host, Device, Stream}wrapper APIs and remove per-backendassert_stream_*invocations. - Add
unsafe impl Send/Sync for Streaminhost::audioworklet; stop re-exportingStreamfromhost::coreaudioon macOS.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/traits.rs | Adds Send + Sync supertraits and deprecates assert_stream_send!/assert_stream_sync!. |
| src/host/custom/mod.rs | Removes redundant Send + Sync / T::Stream: Send + Sync bounds now implied by traits. |
| src/host/audioworklet/mod.rs | Adds unsafe impl Send/Sync for Stream to satisfy the new supertrait. |
| src/host/coreaudio/mod.rs | Stops re-exporting Stream on macOS and removes the assertion macros. |
| src/host/{alsa,aaudio,asio,jack,null,wasapi,webaudio}/... | Removes now-redundant assert_stream_send!/assert_stream_sync! calls. |
| CHANGELOG.md | Notes the new bounds and macro deprecations. |
| UPGRADING.md | Adds a v0.18→v0.19 section describing the breaking change for custom hosts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1ed7c36 to
23a18e6
Compare
23a18e6 to
18ff01f
Compare
9982151 to
6efd77e
Compare
e07fb4f to
234fdbe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also refactors the
Streamassertions forSend + Syncbounds.Fixes #435