Skip to content

fix: remove default() and new() where not cross-platform compatible#1212

Merged
roderickvd merged 2 commits into
masterfrom
fix/revert-default-impls
May 20, 2026
Merged

fix: remove default() and new() where not cross-platform compatible#1212
roderickvd merged 2 commits into
masterfrom
fix/revert-default-impls

Conversation

@roderickvd
Copy link
Copy Markdown
Member

Revert most of #1211 where Default and new were not cross-compatible and/or non-idiomatic for private use.

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

This PR removes recently-added Default impls and new() constructors from several host/backend-specific types where they’re not meant to be relied on cross-platform, and adjusts call sites accordingly (e.g., constructing devices/iterators directly instead of via Default/new()).

Changes:

  • Removed Default derives / impls and new() constructors from various backend Host/Device/iterator types (WebAudio, AudioWorklet, Null, WASAPI, CoreAudio macOS/iOS, AAudio, ALSA).
  • Replaced Default-based construction with explicit construction (e.g., Devices(is_available) / Device(None)).
  • ALSA default device creation now reuses the host’s existing context instead of creating a new one via Default.

Reviewed changes

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

Show a summary per file
File Description
src/host/webaudio/mod.rs Removes Default/new() and constructs Devices explicitly based on WebAudio availability.
src/host/wasapi/mod.rs Removes Default derive from WASAPI Host.
src/host/null/mod.rs Removes Default/new() from Null backend types and updates devices() accordingly.
src/host/coreaudio/macos/mod.rs Removes Default derive from CoreAudio macOS Host.
src/host/coreaudio/ios/mod.rs Removes Default/new() usage and constructs Devices directly (currently introduces a privacy/constructability issue).
src/host/coreaudio/ios/enumerate.rs Removes Devices::new()/Default for iOS enumerator iterator.
src/host/audioworklet/mod.rs Removes Default/new() and constructs Devices explicitly from availability.
src/host/alsa/mod.rs Removes Default for ALSA Device; adds Host::default_device() using the host context.
src/host/aaudio/mod.rs Removes Default/new() for AAudio Device and replaces call sites with Device(None).
CHANGELOG.md Updates changelog entries to reflect removed Default/new() additions and related fixes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/host/coreaudio/ios/mod.rs
Comment thread src/host/coreaudio/ios/enumerate.rs
@roderickvd roderickvd merged commit d5548c0 into master May 20, 2026
32 checks passed
@roderickvd roderickvd deleted the fix/revert-default-impls branch May 20, 2026 20:00
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