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

#317 in Filesystem

Download history 3372/week @ 2024-01-03 3606/week @ 2024-01-10 3569/week @ 2024-01-17 3518/week @ 2024-01-24 3230/week @ 2024-01-31 3607/week @ 2024-02-07 3794/week @ 2024-02-14 3664/week @ 2024-02-21 3326/week @ 2024-02-28 4255/week @ 2024-03-06 3311/week @ 2024-03-13 3914/week @ 2024-03-20 3806/week @ 2024-03-27 4222/week @ 2024-04-03 4456/week @ 2024-04-10 3602/week @ 2024-04-17

16,750 downloads per month
Used in 86 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

~0.3–0.8MB
~19K SLoC