XU XUv0.8.8
中文

API

#os/user

import: #os/user

counts: 3 fns, 0 methods, 1 types, 0 consts, 0 ifaces

Current user from uid/gid + USER/HOME. Lookup only succeeds for the current user.

struct User

XuAPI
pub struct User {
    pub uid string
    pub gid string
    pub username string
    pub name string
    pub home_dir string
}

Purpose

`os/user` subset. Current is filled from uid/gid + USER/HOME (no getpwuid). Lookup/LookupId succeed only for the current user.

Parameters

uid string
field (string)
gid string
field (string)
username string
field (string)
name string
name
home_dir string
field (string)

current

XuAPI
pub fn current() User

Purpose

current; returns User.

Parameters

none

Returns

User — a value of this type

lookup

XuAPI
pub fn lookup(username string) User

Purpose

Lookup. Throws on failure.

Parameters

username string
username (string)

Returns

User — a value of this type

lookup_id

XuAPI
pub fn lookup_id(uid string) User

Purpose

Lookup id. Throws on failure.

Parameters

uid string
uid (string)

Returns

User — a value of this type