https://github.com/icelain/rin
A small rust library to fetch system information on linux
https://github.com/icelain/rin
Last synced: about 1 year ago
JSON representation
A small rust library to fetch system information on linux
- Host: GitHub
- URL: https://github.com/icelain/rin
- Owner: Icelain
- License: mit
- Created: 2022-01-22T15:34:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-23T07:49:41.000Z (almost 2 years ago)
- Last Synced: 2025-04-14T23:10:00.699Z (about 1 year ago)
- Language: Rust
- Homepage:
- Size: 43 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://docs.rs/rin-sys/0.1.0/rin_sys/)
# rin
A small rust library to fetch system information on linux
# Installation
Add ``` rin-sys = "0.1.4" ``` to your Cargo.toml
# Usage
```rust
let ram_info = rin_sys::get_ram_info();
let cpu_info = rin_sys::get_cpu_info();
```
RAM info struct -
```rust
#[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 -
```rust
#[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,
}
```