#root #system #admin #sudo

is-root

A simple library to detect whether you are root/admin or not

4 releases

0.1.3 Aug 4, 2023
0.1.2 Aug 16, 2020
0.1.1 Aug 16, 2020
0.1.0 Aug 16, 2020

#39 in Windows APIs

Download history 252/week @ 2023-12-14 136/week @ 2023-12-21 149/week @ 2023-12-28 207/week @ 2024-01-04 302/week @ 2024-01-11 283/week @ 2024-01-18 278/week @ 2024-01-25 223/week @ 2024-02-01 295/week @ 2024-02-08 247/week @ 2024-02-15 347/week @ 2024-02-22 362/week @ 2024-02-29 767/week @ 2024-03-07 373/week @ 2024-03-14 369/week @ 2024-03-21 302/week @ 2024-03-28

1,850 downloads per month
Used in 4 crates (2 directly)

MIT license

5KB

is-root

Downloads License crates.io docs.rs Gitlab CI

A simple library to detect whether you are root/admin or not

Installation

Add is-root = "0.1.2" to [dependencies] section in your Cargo.toml

Usage

use is_root::is_root;

if is_root() {
    println!("Doing something dangerous")
} else {
    eprintln!("Run me as root")
}

You can find examples in examples directory


lib.rs:

A simple library to detect whether you are root/admin or not

Usage

use is_root::is_root;

if is_root() {
    println!("Doing something dangerous")
} else {
    eprintln!("Run me as root")
}

Dependencies

~80–295KB