Crates.io | sysinfo_rs |
lib.rs | sysinfo_rs |
version | 0.1.8 |
source | src |
created_at | 2024-09-14 09:03:33.104779 |
updated_at | 2024-10-08 06:25:31.129648 |
description | A library for retrieving system information. |
homepage | |
repository | https://github.com/chenzongyao200127/sysinfo_rs |
max_upload_size | |
id | 1374589 |
size | 44,772 |
A library for retrieving system information.
use sysinfo_rs::get_machine_info;
fn main() -> anyhow::Result<()> {
let machine_info = get_machine_info()?;
println!("{:?}", machine_info);
Ok(())
}
Before using this library, ensure that you have libudev-devel
installed on your system. This is required for the libudev-sys
crate, which is a dependency of sysinfo_rs
.
You can install libudev-devel
using your package manager. For example:
On Debian-based systems (like Ubuntu):
sudo apt-get install libudev-dev
On Red Hat-based systems (like CentOS or Fedora):
sudo yum install libudev-devel
hardware
: Contains information about the hardware.
cpu_is_virtual
: Analyzes the results of the cpuid
command execution to determine if the system is running in a virtual machine (key field).disk_serial_number
: The serial number of the hard disk.mac_addresses
: A list of MAC addresses for all network interfaces in the system.bios_info
: Contains BIOS information, including manufacturer, version, release date, and whether it's a virtual machine.system_info
: System manufacturer, product name, serial number, and UUID.enclosure_info
: Chassis information, including manufacturer, type, version, serial number, and asset tag number.software
: Contains information about the software.
os_release
: Operating system version information.uname
: System uname
information, including machine, nodename, release, sysname, and version fields.