faccess 0.1.0

Simple file accessibility checks
Documentation

Cargo

faccess

Basic file accessibility checks for Rust.

Synopsis

use std::path::Path;
use faccess::PathExt;

let path = Path::new("/bin/ls");
assert!(path.readable());
assert!(!path.writable());
assert!(path.executable());

On Unix, this uses faccessat(2) with AT_EACCESS to check against the effective user and group ID's, on other platforms it simply proxies to exists() and readonly() as appropriate.

Caveats

Beware not to introduce any serious time-of-check to time-of-use (TOCTOU) bugs with these functions. They are strictly best-effort and are absolutely not alternatives to checking to see if opening a file or launching a program actually succeeded.