Crate async_user_lookup
source · [−]Expand description
async_user_lookup
provides an easy way to lookup Linux/Unix user and group information
from /etc/passwd and /etc/group. It uses tokio async and 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 async_user_lookup::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());
}
Structs
A group entry, representing one row in
/etc/group
The main entity to reaad and lookup groups information. It supports caching the information to avoid having to read the information from disk more than needed.
A passwd entry, representing one row in
/etc/passwd
The main entity to reaad and lookup user information. It supports caching the information to avoid having to read the information from disk more than needed.