retch_sysinfo/lib.rs
1// SPDX-FileCopyrightText: 2026 Ken Tobias
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4//! # retch-sysinfo
5//!
6//! System information gathering library for retch.
7//!
8//! Provides cross-platform hardware and OS detection, GPU identification,
9//! battery status, and environment probing. Extracted from the `retch-cli`
10//! binary to allow reuse as a standalone library.
11//!
12//! ## Modules
13//!
14//! - [`audio`] — Audio server and device detection.
15//! - [`battery`] — Cross-platform battery status detection.
16//! - [`bios`] — BIOS / firmware version detection.
17//! - [`bluetooth`] — Bluetooth controller state and connected device detection.
18//! - [`camera`] — Camera and webcam detection.
19//! - [`display`] — Display detection and EDID parsing.
20//! - [`gamepad`] — Gamepad and joystick controller detection.
21//! - [`gpu`] — GPU detection and PCI ID lookup.
22//! - [`gpu_api`] — Vulkan, OpenGL and OpenCL API version detection.
23//! - [`input`] — Keyboard and pointing-device detection.
24//! - [`io`] — Disk and network I/O throughput sampling.
25//! - [`disk`] — Physical disk model, size, and type detection.
26//! - [`media`] — Active media player and currently playing track detection.
27//! - [`memory`] — Physical memory (RAM) slot detection.
28//! - [`motherboard`] — Motherboard / system model detection.
29//! - [`network`] — Network interface detection, IP resolution, and Wi-Fi.
30//! - [`packages`] — Installed package count detection.
31//! - [`shell`] — Shell detection and version querying.
32//! - [`terminal`] — Terminal emulator detection and font configuration reading.
33//! - [`theme`] — UI theme, icon, cursor, and font detection.
34//! - [`weather`] — Weather information via Open-Meteo.
35//! - [`wm`] — Window manager detection.
36//! - [`fetch`] — Full system information gathering (`SystemInfo`, `CollectOptions`).
37
38pub mod audio;
39pub mod battery;
40pub mod bios;
41pub mod bluetooth;
42pub mod btrfs;
43pub mod camera;
44pub mod disk;
45pub mod display;
46pub mod fetch;
47pub mod gamepad;
48pub mod gpu;
49pub mod gpu_api;
50pub mod input;
51pub mod io;
52pub mod media;
53pub mod memory;
54pub mod motherboard;
55pub mod network;
56pub mod packages;
57pub mod shell;
58pub mod terminal;
59pub mod theme;
60pub mod weather;
61pub mod wm;
62pub mod zfs;
63
64// Gated on `test` as well as `windows` so the pure interface-classification rule (which
65// decides whether a `GetIfTable2` row is a real adapter or an NDIS filter instance) is
66// exercised by the Linux and macOS CI legs too — it is the load-bearing half, and it needs
67// no Windows API to test.
68#[cfg(any(target_os = "windows", test))]
69pub(crate) mod win_iftable;
70#[cfg(target_os = "windows")]
71pub(crate) mod win_reg;
72#[cfg(target_os = "windows")]
73pub(crate) mod win_setupapi;
74#[cfg(target_os = "windows")]
75pub(crate) mod win_users;
76
77#[cfg(target_os = "macos")]
78pub(crate) mod macos_ffi;
79
80pub use fetch::{CollectOptions, SystemInfo};
81
82/// The crate README's code examples, compiled as doctests.
83///
84/// The README is the crates.io page, and its example had stopped compiling without anything
85/// noticing — it borrowed `CollectOptions`, ignored the `Result`, and read plain `String`
86/// fields as `Option`s. Including it here makes `cargo test --workspace` compile it.
87#[doc = include_str!("../README.md")]
88#[cfg(doctest)]
89pub struct ReadmeDoctests;