whoami/
lib.rs

1//! Crate for getting the user's username, realname and environment.
2//!
3//! ## Getting Started
4//! Using the whoami crate is super easy!  All of the public items are simple
5//! functions with no parameters that return [`String`]s or [`OsString`]s (with
6//! the exception of [`desktop_env()`], [`platform()`], and [`arch()`], which
7//! return enums, and [`langs()`] that returns an iterator of [`String`]s).  The
8//! following example shows how to use all of the functions (except those that
9//! return [`OsString`]):
10//!
11//! ```rust
12//! println!(
13//!     "User's Name            whoami::realname():    {}",
14//!     whoami::realname(),
15//! );
16//! println!(
17//!     "User's Username        whoami::username():    {}",
18//!     whoami::username(),
19//! );
20//! println!(
21//!     "User's Language        whoami::lang():        {:?}",
22//!     whoami::lang().collect::<Vec<String>>(),
23//! );
24//! println!(
25//!     "Device's Pretty Name   whoami::devicename():  {}",
26//!     whoami::devicename(),
27//! );
28//! println!(
29//!     "Device's Hostname      whoami::hostname():    {}",
30//!     whoami::hostname(),
31//! );
32//! println!(
33//!     "Device's Platform      whoami::platform():    {}",
34//!     whoami::platform(),
35//! );
36//! println!(
37//!     "Device's OS Distro     whoami::distro():      {}",
38//!     whoami::distro(),
39//! );
40//! println!(
41//!     "Device's Desktop Env.  whoami::desktop_env(): {}",
42//!     whoami::desktop_env(),
43//! );
44//! println!(
45//!     "Device's CPU Arch      whoami::arch():        {}",
46//!     whoami::arch(),
47//! );
48//! ```
49//!
50//! [`OsString`]: std::ffi::OsString
51
52#![warn(
53    anonymous_parameters,
54    missing_copy_implementations,
55    missing_debug_implementations,
56    missing_docs,
57    nonstandard_style,
58    rust_2018_idioms,
59    single_use_lifetimes,
60    trivial_casts,
61    trivial_numeric_casts,
62    unreachable_pub,
63    unused_extern_crates,
64    unused_qualifications,
65    variant_size_differences,
66    unsafe_code
67)]
68#![doc(
69    html_logo_url = "https://raw.githubusercontent.com/ardaku/whoami/v1/res/icon.svg",
70    html_favicon_url = "https://raw.githubusercontent.com/ardaku/whoami/v1/res/icon.svg"
71)]
72
73mod api;
74mod arch;
75mod conversions;
76mod desktop_env;
77pub mod fallible;
78mod language;
79mod os;
80mod platform;
81mod result;
82
83#[allow(deprecated)]
84pub use self::{
85    api::{
86        arch, desktop_env, devicename, devicename_os, distro, distro_os,
87        hostname, hostname_os, lang, langs, platform, realname, realname_os,
88        username, username_os,
89    },
90    arch::{Arch, Width},
91    desktop_env::DesktopEnv,
92    language::{Country, Language},
93    platform::Platform,
94    result::Result,
95};