sysinfo/unix/
mod.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3cfg_if! {
4    if #[cfg(any(target_os = "macos", target_os = "ios"))] {
5        pub(crate) mod apple;
6        pub(crate) use apple as sys;
7
8        #[allow(unused_imports)]
9        pub(crate) use libc::__error as libc_errno;
10    } else if #[cfg(any(target_os = "linux", target_os = "android"))] {
11        pub(crate) mod linux;
12        pub(crate) use linux as sys;
13
14        #[cfg(target_os = "linux")]
15        #[allow(unused_imports)]
16        pub(crate) use libc::__errno_location as libc_errno;
17        #[cfg(target_os = "android")]
18        #[allow(unused_imports)]
19        pub(crate) use libc::__errno as libc_errno;
20    } else if #[cfg(target_os = "freebsd")] {
21        pub(crate) mod freebsd;
22        pub(crate) use freebsd as sys;
23
24        #[allow(unused_imports)]
25        pub(crate) use libc::__error as libc_errno;
26    } else {
27        compile_error!("Invalid cfg!");
28    }
29
30    if #[cfg(feature = "disk")] {
31        pub(crate) struct DisksInner {
32            pub(crate) disks: Vec<crate::Disk>,
33        }
34
35        impl DisksInner {
36            pub(crate) fn from_vec(disks: Vec<crate::Disk>) -> Self {
37                Self { disks }
38            }
39
40            pub(crate) fn into_vec(self) -> Vec<crate::Disk> {
41                self.disks
42            }
43        }
44    }
45
46    if #[cfg(feature = "network")] {
47        pub(crate) mod network_helper;
48    }
49
50    if #[cfg(feature = "user")] {
51        pub(crate) mod users;
52        pub(crate) mod groups;
53    }
54}
55
56pub(crate) mod utils;
57
58// Make formattable by rustfmt.
59#[cfg(any())]
60mod apple;
61#[cfg(any())]
62mod freebsd;
63#[cfg(any())]
64mod groups;
65#[cfg(any())]
66mod linux;
67#[cfg(any())]
68mod network_helper;
69#[cfg(any())]
70mod users;