#os/user
Xu 0.16.0 API
import: #os/user
counts: 3 functions, 0 methods, 1 types, 0 constants, 0 method sets
Current user from uid/gid + USER/HOME. Lookup only succeeds for the current user.
struct User
pub struct User {
pub uid string
pub gid string
pub username string
pub name string
pub home_dir string
}
Purpose
Structure encapsulating uid, gid, username, name, home_dir.
Public fields
uid string- field (string)
gid string- field (string)
username string- field (string)
name string- name
home_dir string- field (string)
current
Purpose
Execute current.
Parameters
No arguments are required.
Returns
User — a value of this type
lookup
pub fn lookup(username string) User
Purpose
Look up matching key or item in index or collection. Throws on failure; handle the error or propagate it to the caller.
Parameters
username string- username (string)
Returns
User — a value of this type
lookup_id
pub fn lookup_id(uid string) User
Purpose
Lookup id. Throws on failure; handle the error or propagate it to the caller.
Parameters
uid string- uid (string)
Returns
User — a value of this type