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
13
14
15
16
17
use crate::host;
use crate::to_str;

use libc::utsname;
use std::io::Error;

/// Get the os version.
pub fn get_os_version() -> Result<String, Error> {
    let x = host::get_uname()?;
    Ok(to_str(x.version.as_ptr()).to_owned())
}

/// Inlined function to get the os version from a reference of uname.
#[inline]
pub(crate) fn get_os_version_from_uname(uts: &utsname) -> String {
    to_str(uts.version.as_ptr()).to_owned()
}