7 releases (stable)

1.4.0 Jul 25, 2022
1.3.1 Mar 25, 2021
1.3.0 Mar 23, 2018
1.2.0 Sep 26, 2017
0.1.0 Sep 25, 2017

#301 in Filesystem

Download history 3749/week @ 2024-07-30 5290/week @ 2024-08-06 3617/week @ 2024-08-13 3802/week @ 2024-08-20 3317/week @ 2024-08-27 4104/week @ 2024-09-03 3024/week @ 2024-09-10 3791/week @ 2024-09-17 3850/week @ 2024-09-24 3860/week @ 2024-10-01 4451/week @ 2024-10-08 4820/week @ 2024-10-15 4058/week @ 2024-10-22 4288/week @ 2024-10-29 3686/week @ 2024-11-05 4065/week @ 2024-11-12

16,941 downloads per month
Used in 132 crates (5 directly)

CC-PDDC license

10KB
130 lines

pwd module for unix-y systems

link link="https://deps.rs/repo/gitlab/pwoolcoc/pwd",alt="dependency status"

This is a small veneer over pwd.h, mostly just hides away the unsafe parts.

Installation

In the [dependencies] section of your Cargo.toml, add the following line:

[source="rust"]

[dependencies]
pwd = "1"

Usage

[source="rust"]

use pwd::Passwd;

fn main() {
    let me = Passwd::current_user();
    println!("my username is {}, home directory is {}, and my shell is {}. My uid/gid are {}/{}",
             me.name, me.dir, me.shell, me.uid, me.gid);
}

lib.rs:

Safe interface to <pwd.h>

This module, named after the python module with the same function, is a safe interafce to pwd.h on unix-y systems. Currently nothing from this module compiles on Windows, or attempts to make any kind of similar interface for Windows.

Dependencies

~250–750KB
~18K SLoC