(&self)
| 574 | |
| 575 | /// Pick the device a cached name points at, else the default entry. |
| 576 | /// |
| 577 | /// Backends reorder and renumber devices between scans, so a saved selection is |
| 578 | /// matched by name and never by list position. |
| 579 | pub fn resolve_mic_device<'a>( |
| 580 | devices: &'a [MicDevice], |
| 581 | wanted: Option<&str>, |
| 582 | ) -> Option<&'a MicDevice> { |
| 583 | if let Some(wanted) = wanted { |
| 584 | let names: Vec<&str> = devices.iter().map(|device| device.name.as_str()).collect(); |
| 585 | if let Some(index) = match_device_index(&names, wanted) { |
| 586 | return devices.get(index); |
| 587 | } |
| 588 | } |
no test coverage detected