Skip to content

HostId enum Refactor#1274

Open
cbrownsey wants to merge 2 commits into
RustAudio:developfrom
cbrownsey:develop
Open

HostId enum Refactor#1274
cbrownsey wants to merge 2 commits into
RustAudio:developfrom
cbrownsey:develop

Conversation

@cbrownsey

@cbrownsey cbrownsey commented Jul 15, 2026

Copy link
Copy Markdown

Original Issue: #1260

This implements the change to having HostId include a variant for all possible hosts under any compilation configuration.

This also adds an implementation of TryFrom<HostId> for Host, which seemed the best way to have that. This also keeps available_hosts, host_from_id, and ALL_HOSTS, although they no longer seem relevant to keep anymore.

+ Added `host_id` sub-module, which contains the `HostId` non-exhaustive
  enum, and all associated implementations and definitions.
+ Added internal implementations in `platform::impl_platform_host`.
+ Added implementation of `TryFrom<HostId> for Host`.

* Fixed links broken by moving `host_from_id` and `available_hosts`.
* Added additional error kind to `host_from_id`.

- Removed all definitions and impls of `HostId` from `platform`.
- Removed `__cpal_select_host_name` internal macro.
- Removed `default_host` from all `platform_impl` modules.
* Fixed hanging indentation on doc comment.

- Removed import of `HostTrait` in `platform_impl` of `wasm-bindgen`
  target.
@cbrownsey

Copy link
Copy Markdown
Author

Ack! Rookie mistake. All green now, but I'm not sure if I'm entirely keen on pushing as-is. I think the HostId enum should be pulled out of the platform module and be re-exported at the crate root. Additionally, I'm thinking that the available_hosts, host_from_id and ALL_HOSTS items should be canned. But this is what I outlined in the initial issue, so that's what I'm committing right now.

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.

1 participant