Crates.io | sysinfo_dot_h |
lib.rs | sysinfo_dot_h |
version | 0.2.1 |
source | src |
created_at | 2024-03-18 23:26:02.728726 |
updated_at | 2024-04-14 00:07:45.786202 |
description | A tiny sys/sysinfo.h wrapper |
homepage | |
repository | https://github.com/WilliamAnimate/sysinfo_dot_h |
max_upload_size | |
id | 1178598 |
size | 8,576 |
A tiny <sys/sysinfo.h> wrapper in Rust
Quick start:
use sysinfo_dot_h::try_collect;
let info = try_collect().unwrap();
dbg!(info.uptime); // uptime in seconds
or
use sysinfo_dot_h::collect;
let info = collect();
dbg!(info.uptime); // uptime in seconds
This makes it easier (and quicker) to port the following C code to rust:
#include <sys/sysinfo.h>
int main() {
struct sysinfo *info;
sysinfo(info);
}
The sysinfo crate was too slow for my use case (200 milliseconds) so I made my own.
Please note that unlike sysinfo, this crate only works on Linux, so if your application is cross platform it may not be favourable to use this crate.