sys_metrics 0.2.7

Cross-platform library to gather stats/information from the host
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::io::Error;

/// Return the sysinfo information
pub(crate) fn sysinfo() -> Result<libc::sysinfo, Error> {
    let mut info = std::mem::MaybeUninit::<libc::sysinfo>::uninit();

    if unsafe { libc::sysinfo(info.as_mut_ptr()) } == -1 {
        Err(Error::last_os_error())
    } else {
        Ok(unsafe { info.assume_init() })
    }
}