Changelog & History
Relevant source files
The following files were used as context for generating this wiki page:
The rust-battery project maintains a comprehensive history of its evolution through a structured changelog and versioning system. The project adheres to Semantic Versioning and uses the Keep a Changelog format to document notable changes across its cross-platform API for notebook batteries.
The project's history reflects a transition from its original development under svartalf/rust-battery to its current home within the starship organization. Its primary goal remains providing a unified, typed API for battery information (state of charge, energy rate, voltage, temperature) recalculated into SI measurement units across various operating systems.
Sources: CHANGELOG.md:1-10, README.md:1-25, src/lib.rs:1-10
Project Evolution and Versioning
The library has transitioned through several major milestones, expanding its platform support and refining its internal architecture to handle hardware-specific edge cases.
Recent Major Versions
| Version | Date | Key Highlights |
|---|---|---|
| 0.11.0 | 2026-04-03 | macOS migration to objc2. |
| 0.10.0 | 2024-08-31 | Windows implementation switched from winapi to windows-sys. |
| 0.9.0 | 2024-06-08 | Added NetBSD support via envsys ioctl and plist. |
| 0.8.0 | 2023-04-12 | Breaking changes: CI rework, code cleanup, and serde/schemars derivation for State. |
| 0.7.0 | 2019-03-10 | Massive refactor: transition to uom SI units, renamed methods, and non-exhaustive enums. |
Sources: CHANGELOG.md:12-250, Cargo.toml:1-15
Architectural Milestones
The project's history is marked by a shift toward strict typing and SI unit adherence. In version 0.7.0, the API was significantly altered to return SI measurement units from the uom crate rather than raw numeric types. This included renaming Battery::percentage to Battery::state_of_charge and Battery::capacity to Battery::state_of_health.
The following diagram illustrates the data flow transition from raw OS data to the library's unified SI types:
A brief overview of how the library abstracts platform-specific data into a common SI-based interface.
Sources: CHANGELOG.md:188-195, src/lib.rs:3-5, src/platform/traits.rs:10-25
Feature History and Platform Expansion
The library's history shows a continuous effort to expand support across the BSD family and modern macOS/Windows environments.
Platform Support Timeline
- Linux: Initial support via
sysfs. Version 0.7.5 fixed issues with missingenergy_full_designfiles (Issue #40). - macOS: Early versions used
CoreFoundation-sysandIOKit-sys. Version 0.11.0 migrated toobjc2for better modern compatibility. - Windows: Transitioned to
windows-sysin version 0.10.0. - BSD Support: Version 0.7.0 added multi-device support for FreeBSD/DragonFlyBSD. Version 0.9.0 introduced NetBSD support.
Sources: CHANGELOG.md:12-50, CHANGELOG.md:196-205, README.md:27-35
Critical Bug Fixes and Reliability
The CHANGELOG.md records numerous fixes for hardware-specific edge cases where drivers report invalid or misleading data:
- Zero Cycles: Linux drivers often report 0 cycles for old batteries; version 0.7.1 began treating zero as a non-existing value to improve accuracy.
- Energy Rates: Version 0.6.1 fixed cases where
energy_ratewas reported as zero when a charger was recently unplugged. - Infinite Recursion: Version 0.7.4 fixed a recursive loop in
Battery::energy_full_design.
Sources: CHANGELOG.md:175-178, CHANGELOG.md:215-217, CHANGELOG.md:224-226, src/platform/linux/sysfs/source.rs:242-255
Development Lifecycle and CI
The project's maintenance history includes a significant modernization effort in version 0.8.0, which focused on "CI rework & code cleanup." This ensured stricter compilation checks and better platform testing.
Dependency Management
The project tracks minimum supported Rust versions (MSRV) carefully. As of the current documentation, the MSRV is 1.89.
The dependency hierarchy supporting different target platforms while maintaining a consistent MSRV.
Sources: Cargo.toml:13-65, README.md:37-40, CHANGELOG.md:71-75
Summary of Significant Changes
The project has evolved from a simple battery-reading utility to a robust, cross-platform measurement library. Key milestones include:
- Transition to uom: Using the
uomcrate to ensure type safety for physical quantities. - Platform Maturity: Moving from raw FFI calls to structured wrappers like
objc2andwindows-sys. - Handling Driver Flaws: Implementing logic to filter out invalid driver data (e.g., negative charge rates or zero cycle counts on used batteries).
Sources: CHANGELOG.md:12-250, src/platform/linux/sysfs/source.rs:165-200, src/platform/traits.rs:100-140