Crate jolt_platform

Crate jolt_platform 

Source
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§

units

Structs§

BatteryInfo
Battery information snapshot.
PowerInfo
Power information snapshot.

Enums§

BatteryTechnology
Battery technology/chemistry type.
ChargeState
Battery charging state.
PowerMode
System power mode.

Traits§

BatteryProvider
Trait for platform-specific battery providers.
PowerProvider
Trait for platform-specific power providers.