cpal
cpal copied to clipboard
Add extra devices iterator type alias
Description
This change adds an additional type alias DevicesFiltered that the InputDevices and OuputDevices can both become aliases to since they are both the same type, rather than having the same type declared separately twice.
This makes it easier for working with the functions in a case where you may be wanting to filter over either input or output devices using the same function like so:
type DevicesFn = fn(&Host) -> Result<DevicesFiltered, DevicesError>;
let devices_fn: DevicesFn = if output {
Host::output_devices
} else {
Host::input_devices
};
let devices_iter = devices_fn(host)
.expect("Failed to load devices");
Changes
- Add
DevicesFilteredtype alias shared by bothInputDevicesandOuputDevices