Skip to main content

Crate batno

Crate batno 

Source
Expand description

§BatNo

A battery monitoring library that periodically checks battery status and sends notifications when the battery reaches a configured threshold.

§Extending BatNo

Platform-specific functionality is isolated behind two traits:

To add support for a new operating system:

  1. Implement BatteryProvider for the new platform.
  2. Implement SystemNotifier for the platform’s notification system.
  3. Create a constructor that combines those implementations into a BatteryMonitor.

The monitoring logic does not need to change as long as the new types implement the required traits.

Structs§

BatteryMonitor
Coordinates battery monitoring and notification handling.
LinuxBattery
Battery provider implementation for Linux systems.
LinuxNotifier
Sends desktop notifications using the Linux notify-send command.

Enums§

BatteryStatus
Represents the current state of a battery.

Traits§

BatteryProvider
Provides access to battery information.
SystemNotifier
Provides a way to send system notifications.

Functions§

monitor_battery
Continuously monitors battery level and sends notifications when required.
print_battery_info
Prints battery information as a formatted table.