Crates.io | permissions |
lib.rs | permissions |
version | 0.5.1 |
source | src |
created_at | 2020-09-22 05:30:06.531273 |
updated_at | 2023-09-04 18:33:10.912343 |
description | Library to query for file permissions (read, write, execute, removal and creation). |
homepage | |
repository | https://github.com/marcospb19/permissions |
max_upload_size | |
id | 291407 |
size | 15,288 |
If you want Windows support, check faccess instead.
Useful filesystem queries for file permissions:
See functions
.
is_executable
is_readable
is_writable
is_removable
is_creatable
access_syscall
supports a custom bitfield of permissions.use permissions::*;
fn main() -> std::io::Result<()> {
// Functions accept `AsRef<Path>`
assert!(is_readable("src/")?);
assert!(is_writable("src/")?);
assert!(is_writable("src/lib.rs")?);
assert!(is_executable("/usr/bin/cat")?);
assert!(is_removable("src/lib.rs")?);
assert!(is_creatable("src/file.rs")?);
Ok(())
}