pub async fn all_devices(
    device_type: InputDeviceType,
) -> Result<Vec<fidl_fuchsia_input_report::InputDeviceProxy>, Error> {
    let input_report_dir = Path::new(INPUT_REPORT_PATH);
    let entries: ReadDir = read_dir(input_report_dir)
        .with_context(|_| format!("Failed to read input report directory {}", INPUT_REPORT_PATH))?;

    let mut devices: Vec<fidl_fuchsia_input_report::InputDeviceProxy> = vec![];
    for entry in entries.filter_map(Result::ok) {
        let entry_path = entry.path();
        if let Ok(input_device) = get_device_from_dir_entry_path(&entry_path) {
            if is_device_type(&input_device, device_type).await {
                devices.push(input_device);
            }
        }
    }

    Ok(devices)
}
/// Returns all the devices of the given device type.
///
/// # Parameters
/// - `device_type`: The type of devices to return.
///
/// # Errors
/// If the input device directory cannot be read.
Returns all the devices of the given device type.
Returns all the devices of the given device type .
pub async fn all_devices(
    device_type: InputDeviceType,
) -> Result<Vec<fidl_fuchsia_input_report::InputDeviceProxy>, Error> {
    let input_report_dir = Path::new(INPUT_REPORT_PATH);
    let entries: ReadDir = read_dir(input_report_dir)
        .with_context(|_| format!("Failed to read input report directory {}", INPUT_REPORT_PATH))?;
    let mut devices: Vec<fidl_fuchsia_input_report::InputDeviceProxy> = vec![];
    for entry in entries.filter_map(Result::ok) {
        let entry_path = entry.path();
        if let Ok(input_device) = get_device_from_dir_entry_path(&entry_path) {
            if is_device_type(&input_device, device_type).await {
                devices.push(input_device);
            }
        }
    }
    Ok(devices)
}
pub async fn all_devices ( device_type : InputDeviceType , ) -> Result < Vec < fidl_fuchsia_input_report :: InputDeviceProxy > , Error > { let input_report_dir = Path :: new ( INPUT_REPORT_PATH ) ; let entries : ReadDir = read_dir ( input_report_dir ) . with_context ( | _ | format ! ( " " INPUT_REPORT_PATH ) ) ? ; let mut devices : Vec < fidl_fuchsia_input_report :: InputDeviceProxy > = vec ! [ ] ; for entry in entries . filter_map ( Result :: ok ) { let entry_path = entry . path ( ) ; if let Ok ( input_device ) = get_device_from_dir_entry_path ( & entry_path ) { if is_device_type ( & input_device , device_type ) . await { devices . push ( input_device ) ; } } } Ok ( devices ) }
Returns all the devices of the given device type.
Returns all the devices of the given device type .
device_type
InputDeviceType
The type of devices to return.
The type of devices to return .
errors
If the input device directory cannot be read.
If the input device directory cannot be read .