Skip to content

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