Crates.io | rin-sys |
lib.rs | rin-sys |
version | 0.1.4 |
source | src |
created_at | 2022-01-26 08:22:27.269283 |
updated_at | 2024-07-23 07:51:17.852887 |
description | A small library to fetch system information in linux |
homepage | |
repository | https://github.com/icelain/rin |
max_upload_size | |
id | 521409 |
size | 8,636 |
A small rust library to fetch system information on linux
Add rin-sys = "0.1.4"
to your Cargo.toml
let ram_info = rin_sys::get_ram_info();
let cpu_info = rin_sys::get_cpu_info();
RAM info struct -
#[derive(Default, Debug)]
pub struct RamInfo {
pub mem_used: usize,
pub mem_free: usize,
pub mem_total: usize,
pub percent_free: f32,
pub percent_used: f32,
}
CPU info struct -
#[derive(Debug, Default)]
pub struct CpuInfo {
pub cache_size: String,
pub cores: usize,
pub cpu_speed: Vec<(usize, f64)>,
pub model_name: String,
pub vendor_id: String,
pub is_fpu: bool,
pub cpuid_level: f32,
}