/// Try to determine whether this is a USB device or not by searching
/// upwards for a directory name starting with "usb".
Try to determine whether this is a USB device or not by searching
upwards for a directory name starting with "usb".
Try to determine whether this is a USB device or not by searching upwards for a directory name starting with " usb " .
fn is_usb_in_path(path: &Path) -> bool {
    for path in path.ancestors() {
        if let Some(name) = path.file_name() {
            if let Some(name) = name.to_str() {
                if name.starts_with("usb") {
                    return true;
                }
            }
        }
    }
    false
}
fn is_usb_in_path ( path : & Path ) -> bool { for path in path . ancestors ( ) { if let Some ( name ) = path . file_name ( ) { if let Some ( name ) = name . to_str ( ) { if name . starts_with ( " " ) { return true ; } } } } false }
Try to determine whether this is a USB device or not by searching
upwards for a directory name starting with "usb".
Try to determine whether this is a USB device or not by searching upwards for a directory name starting with " usb " .
path
&Path