Function users::get_current_username [−][src]
pub fn get_current_username() -> Option<OsString>
Returns the username of the user running the process.
This function to return None
if the current user does not exist, which
could happed if they were deleted after the program started running.
libc functions used
Examples
use users::get_current_username; match get_current_username() { Some(uname) => println!("Running as user with name {:?}", uname), None => println!("The current user does not exist!"), }