#[non_exhaustive]pub enum DeviceSelector {
Default,
Index(usize),
Name(String),
Id(String),
}Expand description
How to select an audio device.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Default
Use the system default device.
Index(usize)
Select by device index.
Name(String)
Select by case-insensitive name substring match.
Id(String)
Select by stable per-host device ID.
The ID is the string produced by cpal::DeviceId’s Display impl
(WASAPI endpoint ID on Windows, CoreAudio UID on macOS, ALSA pcm_id
on Linux). Matching is exact string equality, not substring.
Obtain an ID from MicrophoneInfo::id / SpeakerInfo::id
returned by input_devices / output_devices.
Prefer Id over Self::Name when you need stable device selection
across enumerations: display names can shift across OS versions or
when other devices are plugged in, but per-host IDs don’t.
Trait Implementations§
Source§impl Clone for DeviceSelector
impl Clone for DeviceSelector
Source§fn clone(&self) -> DeviceSelector
fn clone(&self) -> DeviceSelector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DeviceSelector
impl RefUnwindSafe for DeviceSelector
impl Send for DeviceSelector
impl Sync for DeviceSelector
impl Unpin for DeviceSelector
impl UnsafeUnpin for DeviceSelector
impl UnwindSafe for DeviceSelector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more