get_user_by_uid

Function get_user_by_uid 

Source
pub fn get_user_by_uid(uid: uid_t) -> Option<User>
Expand description

Searches for a User with the given ID in the system’s user database. Returns it if one is found, otherwise returns None.

§libc functions used

§Examples

use users::get_user_by_uid;

match get_user_by_uid(501) {
    Some(user) => println!("Found user {:?}", user.name()),
    None       => println!("User not found"),
}