Crates.io | systeminfo |
lib.rs | systeminfo |
version | 0.1.5 |
source | src |
created_at | 2021-05-17 04:09:54.480755 |
updated_at | 2024-09-10 16:38:25.57188 |
description | Gets the system hardware and os information |
homepage | |
repository | https://github.com/marirs/systeminfo-rs |
max_upload_size | |
id | 398456 |
size | 59,108 |
Get the System Hardware & Operating System information.
[dependencies]
systeminfo = { git = "https://github.com/marirs/systeminfo-rs", branch = "main" }
and then
use systeminfo;
fn main() {
let sysinfo = systeminfo::from_system_hardware();
println!("{:#?}", sysinfo);
let osinfo = systeminfo::from_system_os();
println!("{:#?}", osinfo);
}
If you want to return the object:
use systeminfo::{
consts::SystemHardware,
from_system_hardware
};
fn get_hw_info() -> SystemHardware {
from_system_hardware()
}
fn main() {
println!("{:#?}", get_hw_info())
}
cargo b --example info
SystemHardware {
system_manufacturer: "Apple",
system_model: "MacBookPro15,2 (MacBook Pro)",
serial_number: "C02Z90HQLVDL",
bios: "1554.60.15.0.0 (iBridge: 18.16.13030.0.0,0)",
physical_memory: "16 GB",
processor: "Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz",
architecture: "x86_64",
processor_vendor: "GenuineIntel",
processor_physical_cpus: "4",
processor_logical_cpus: "8",
processor_features: [
"FPU",
...
],
}
SystemOS {
os: "macOS",
kernel: "20.2.0",
edition: "macOS Big Sur",
version: "11.1",
architecture: "64-bit",
hostname: "chocolate",
ip_address: "192.168.0.115",
}
SystemHardware {
system_manufacturer: "Raspberry Pi 4 Model B Rev 1.4",
system_model: "",
serial_number: "10000000f62c0f0d",
bios: "",
physical_memory: "8 GB",
processor: "Cortex-A72",
architecture: "aarch64",
processor_vendor: "ARM",
processor_physical_cpus: "4",
processor_logical_cpus: "4",
processor_features: [
"FP",
...
],
}
SystemOS {
os: "Ubuntu",
kernel: "Linux 5.11.0-1008-raspi",
edition: "HIRSUTE",
version: "21.04 (Hirsute Hippo)",
architecture: "64-bit",
hostname: "chocolate",
ip_address: "192.168.0.116",
}
SystemHardware {
system_manufacturer: "VMware, Inc.",
system_model: "VMware Virtual Platform",
serial_number: "43 2e 97 b3 5e",
bios: "PhoenixBIOS 4.0 Release 6.0 (Wed, 22 Jul 2020 00:00:00 +0000)",
physical_memory: "2.15 GB",
processor: "Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz",
architecture: "X86-based PC",
processor_vendor: "GenuineIntel",
processor_physical_cpus: "1",
processor_logical_cpus: "2",
processor_features: [],
}
SystemOS {
os: "Microsoft Windows",
kernel: "19041",
edition: "Windows 10 Pro",
version: "10.0.19041",
architecture: "32-bit",
hostname: "DESKTOP-G089JUF",
ip_address: "192.168.0.114",
}
License: MIT