UNIXPermissionsExt
A trivial trait bringing missing functions that are not exposed by
std::os::unix::fs::PermissionsExt
to std::fs::Permissions
on UNIX platforms.
Usage
-
Add it to your dependency:
$ cd $YOUR_PROJECT $ cargo add unix_permissions_ext
-
Import this trait and use it just like you are using the standard library!
use ; use UNIXPermissionsExt; let metadata = metadata.expect; let permission = metadata.permissions; assert!;
-
If you have feature
to-string
enabled, you can also useto_string()
to convertPermissions
into a string, just like the one printed byls(1)
# Cargo.toml [] = { = "x.x.x", = ["to-string"] }
let permission_str = to_string; println!;
Contributing
Contributions of all forms are welcome, feel free to file an issue or make a pull request!
Test before your commit
-
Pass the tests
$ cargo test --features "to-string"
-
Format your code
$ cargo fmt