| Crates.io | permissions |
| lib.rs | permissions |
| version | 0.5.1 |
| created_at | 2020-09-22 05:30:06.531273+00 |
| updated_at | 2023-09-04 18:33:10.912343+00 |
| 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_executableis_readableis_writableis_removableis_creatableaccess_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(())
}