Skip to content

feat: require Device to be Send+Sync#1221

Merged
roderickvd merged 3 commits into
developfrom
feat/device-send-sync
May 28, 2026
Merged

feat: require Device to be Send+Sync#1221
roderickvd merged 3 commits into
developfrom
feat/device-send-sync

Conversation

@roderickvd
Copy link
Copy Markdown
Member

Also refactors the Stream assertions for Send + Sync bounds.

Fixes #435

@roderickvd roderickvd force-pushed the feat/device-send-sync branch 3 times, most recently from 6e7d980 to e9a3c79 Compare May 27, 2026 21:59
@roderickvd roderickvd requested a review from Copilot May 28, 2026 17:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + Sync supertrait bounds to DeviceTrait and StreamTrait; deprecate the now-redundant assertion macros.
  • Drop redundant Send + Sync constraints from host::custom::{Host, Device, Stream} wrapper APIs and remove per-backend assert_stream_* invocations.
  • Add unsafe impl Send/Sync for Stream in host::audioworklet; stop re-exporting Stream from host::coreaudio on 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.

Comment thread src/host/audioworklet/mod.rs Outdated
Comment thread src/host/coreaudio/mod.rs Outdated
@roderickvd roderickvd force-pushed the feat/device-send-sync branch from 1ed7c36 to 23a18e6 Compare May 28, 2026 20:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread src/host/audioworklet/mod.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread src/traits.rs
Comment thread src/host/audioworklet/mod.rs
Comment thread src/host/audioworklet/mod.rs
Comment thread src/host/audioworklet/mod.rs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread src/host/audioworklet/mod.rs
Comment thread src/host/audioworklet/mod.rs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Comment thread src/host/audioworklet/mod.rs
Comment thread Cargo.toml Outdated
Comment thread src/host/coreaudio/mod.rs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Comment thread src/host/audioworklet/mod.rs
Comment thread src/host/coreaudio/mod.rs
@roderickvd roderickvd merged commit 29a3577 into develop May 28, 2026
33 checks passed
@roderickvd roderickvd deleted the feat/device-send-sync branch May 28, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants