MIT Latest Version docs Chat on Miaou

umask

A utility to build and display unix access permission modes

Import

In Cargo.toml:

umask = "0.1"

Usage

``` use umask::*;

// You can build from a number: asserteq!("rw-r--r--", Mode::from(0b110100100).tostring()); asserteq!("rw-r--r--", Mode::from(0o644).tostring());

// You may use | to combine class permissions: let mu = Mode::from(0o600); let mo = Mode::from(0o004); let muo = mu | mo; asserteq!("rw----r--", muo.tostring());

// You can build with semantic constructs: let m = Mode::all() .without(ALLEXEC); asserteq!("rw-rw-rw-", m.tostring()); let mut m = Mode::new() .withclassperm(ALL, READ) .withclassperm(USER, WRITE); asserteq!("rw-r--r--", m.to_string());

// Or if you like m |= ALLEXEC; asserteq!("rwxr-xr-x", m.tostring()); let m = ALLREAD | USERWRITE; asserteq!("rw-r--r--", m.to_string());

```