Skip to main content

current

Function current 

Source
pub fn current() -> Result<User>
Expand description

Current returns the current user.

The first call will cache the current user information. Subsequent calls will return the cached value and will not reflect changes to the current user.

Examples found in repository?
examples/user.rs (line 8)
7fn main() {
8    let res = user::current().unwrap();
9    println!("Uid:      {}", res.uid);
10    println!("Gid:      {}", res.gid);
11    println!("Username: {}", res.username);
12    println!("Name:     {}", res.name);
13    println!("HomeDir:  {}", res.home_dir);
14
15    println!("user_id:  {}", os::get_uid());
16}