[][src]Crate whoami

Crate for getting the user's username, realname and environment.

Getting Started

Using the whoami crate is super easy! All of the public items are simple functions with no parameters that return Strings (with the exception of env(), and platform() which return enums). The following example shows how to use all of the functions:

fn main() {
    print!(
        "user's full name     whoami::user():      {}\n\
         username             whoami::username():  {}\n\
         host's fancy name    whoami::host():      {}\n\
         hostname             whoami::hostname():  {}\n\
         platform             whoami::platform():  {}\n\
         operating system     whoami::os():        {}\n\
         desktop environment  whoami::env():       {}\n\
         ",
        whoami::user(),
        whoami::username(),
        whoami::host(),
        whoami::hostname(),
        whoami::platform(),
        whoami::os(),
        whoami::env(),
    );
}

Enums

DesktopEnv

Which Desktop Environment

Platform

Which Platform

Functions

env

Get the desktop environment.

host

Get the host device's (pretty) name.

hostname

Get the host device's hostname.

os

Get the the operating system name and version.

platform

Get the platform.

user

Get the user's full name.

username

Get the user's username.