Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra devices iterator type alias #819

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jacobtread
Copy link

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 DevicesFiltered type alias shared by both InputDevices and OuputDevices

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