Crate user_lookup
source ·Expand description
user_lookup
provides an easy way to lookup Linux/Unix user and group information
from /etc/passwd and /etc/group. It will cache the information for a
duration specified by the user. If no caching is desired, a Duration of 0.0 can be used.
ⓘ
use user_lookup::async_reader::PasswdReader;
use std::time::Duration;
#[tokio::main]
async fn main() {
let mut reader = PasswdReader::new(Duration::new(0,0));
println!("User with uid 1000 is: {}",
reader.get_username_by_uid(1000).await.unwrap().unwrap());
}
Modules
async_reader
uses tokio to provide asynchronous readers for PasswdReader and GroupReader to read and process /etc/passwd and /etc/groupsync_reader
provides readers for PasswdReader and GroupReader, to read and process /etc/passwd and /etc/group
Structs
- A group entry, representing one row in
/etc/group
- A passwd entry, representing one row in
/etc/passwd