sysinfo_dot_h

Crates.iosysinfo_dot_h
lib.rssysinfo_dot_h
version0.2.1
sourcesrc
created_at2024-03-18 23:26:02.728726
updated_at2024-04-14 00:07:45.786202
descriptionA tiny sys/sysinfo.h wrapper
homepage
repositoryhttps://github.com/WilliamAnimate/sysinfo_dot_h
max_upload_size
id1178598
size8,576
William (WilliamAnimate)

documentation

README

sysinfo dot h

A tiny <sys/sysinfo.h> wrapper in Rust

How?

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

Why?

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.

Commit count: 30

cargo fmt