1use std::net::IpAddr;
4
5use crate::Pid;
6
7pub trait UserExt {
14 fn pid(&self) -> Pid;
16
17 fn terminal(&self) -> &str;
19
20 fn id(&self) -> &str;
22
23 fn hostname(&self) -> &str;
25
26 fn address(&self) -> Option<IpAddr>;
28
29 fn session_id(&self) -> i32;
31}
32
33#[cfg(target_os = "linux")]
34impl UserExt for crate::User {
35 fn pid(&self) -> Pid {
36 self.as_ref().pid()
37 }
38
39 fn terminal(&self) -> &str {
40 self.as_ref().terminal()
41 }
42
43 fn id(&self) -> &str {
44 self.as_ref().id()
45 }
46
47 fn hostname(&self) -> &str {
48 self.as_ref().hostname()
49 }
50
51 fn address(&self) -> Option<IpAddr> {
52 self.as_ref().address()
53 }
54
55 fn session_id(&self) -> i32 {
56 self.as_ref().session_id()
57 }
58}