1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! # rsys
//! Crate for aquiring information about host machine and operating system
//! in a os-agnostic fashion.
//!
//! The common api is available through Rsys struct which compiles conditionally with
//! required methods. The error and result type is available at the root of this crate for convienience
//! while all the methods exposed by Rsys struct are also available in each os module.
//!
//! Main goals are clear and easy api with as much of the api being os-agnostic.
//!
//! ## Example usage:
//! - `Cargo.toml`
//!
//! ```toml
//! [dependencies]
//! rsys = "0.4"
//! ```
//!
//! - `main.rs`
//! ```ignore
//! use rsys::{Result, Rsys};
//! fn main() -> Result<()> {
//! // You can either use api through Rsys object
//! // for os-agnostic experience
//! let rsys = Rsys::new();
//! println!("HOSTNAME - {}", rsys.hostname()?);
//! let iface = rsys.default_iface()?;
//! println!("CPU - {}", rsys.cpu()?);
//! println!("ARCH - {}", rsys.arch()?);
//! println!("MEMORY TOTAL - {}b", rsys.memory_total()?);
//! println!("UPTIME - {}s", rsys.uptime()?);
//! println!("SWAP TOTAL - {}b", rsys.swap_total()?);
//! println!("CPU CORES - {}", rsys.cpu_cores()?);
//! println!("CPU CLOCK - {}MHz", rsys.cpu_clock()?);
//! println!("IPv4 - {}", rsys.ipv4(&iface)?);
//! println!("MAC - {}", rsys.mac(&iface)?);
//! println!("INTERFACES - {:#?}", rsys.interfaces()?);
//!
//!
//! // Or use functions in each module
//! if cfg!(target_os = "linux") {
//! println!("KERNEL VERSION - {}", rsys::linux::kernel_version()?);
//! println!("HOSTNAME - {}", rsys::linux::hostname()?);
//!
//! // Os-specific functions are also available as methods
//! println!("MEMORY - {:#?}", rsys.memory()?);
//! println!("KERNEL_VERSION - {:#?}", rsys.kernel_version()?);
//! }
//! Ok(())
//! }
//! ```
extern crate winapi;
extern crate rsys_macro;
pub
pub use Rsys;
pub use ;
pub use linux;
pub use macos;
pub use windows;