fn is_executable(path: &Path) -> bool {
    #[cfg(unix)]
    let has_executable_flag = |meta: Metadata| {
        use std::os::unix::fs::PermissionsExt;
        meta.permissions().mode() & 0o100 != 0
    };
    #[cfg(not(unix))]
    let has_executable_flag = |meta: Metadata| true;

    path.metadata()
        .map(|meta| meta.is_file() && has_executable_flag(meta))
        .unwrap_or_default()
}
/// Check whether a given path exists, is a file and marked as executable (unix only).
Check whether a given path exists, is a file and marked as executable (unix only).
Check whether a given path exists is a file and marked as executable ( unix only ) .
fn is_executable(path: &Path) -> bool {
    #[cfg(unix)]
    let has_executable_flag = |meta: Metadata| {
        use std::os::unix::fs::PermissionsExt;
        meta.permissions().mode() & 0o100 != 0
    };
    #[cfg(not(unix))]
    let has_executable_flag = |meta: Metadata| true;
    path.metadata()
        .map(|meta| meta.is_file() && has_executable_flag(meta))
        .unwrap_or_default()
}
fn is_executable ( path : & Path ) -> bool { # [ cfg ( unix ) ] let has_executable_flag = | meta : Metadata | { use std :: os :: unix :: fs :: PermissionsExt ; meta . permissions ( ) . mode ( ) & 0o100 != 0 } ; # [ cfg ( not ( unix ) ) ] let has_executable_flag = | meta : Metadata | true ; path . metadata ( ) . map ( | meta | meta . is_file ( ) && has_executable_flag ( meta ) ) . unwrap_or_default ( ) }
Check whether a given path exists, is a file and marked as executable (unix only).
Check whether a given path exists is a file and marked as executable ( unix only ) .
path
&Path