pub fn current() -> Result<User>
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.
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}