Expand description
Cross-platform battery and power monitoring for jolt.
This crate provides platform-agnostic traits and types for accessing battery and power information, with platform-specific implementations.
§Features
macos- Enable macOS support (IOReport, SMC, ioreg)linux- Enable Linux support (RAPL, sysfs)
§Example
ⓘ
use jolt_platform::{BatteryProvider, PowerProvider};
#[cfg(target_os = "macos")]
use jolt_platform::macos::{MacOSBattery, MacOSPower};
let mut battery = MacOSBattery::new()?;
battery.refresh()?;
println!("Charge: {}%", battery.info().charge_percent);Modules§
Structs§
- Battery
Info - Battery information snapshot.
- Power
Info - Power information snapshot.
Enums§
- Battery
Technology - Battery technology/chemistry type.
- Charge
State - Battery charging state.
- Power
Mode - System power mode.
Traits§
- Battery
Provider - Trait for platform-specific battery providers.
- Power
Provider - Trait for platform-specific power providers.