starship_battery/
lib.rs

1//! This crate provides cross-platform information about batteries.
2//!
3//! Gives access to a system independent battery state, capacity, charge and voltage values
4//! recalculated as necessary to be returned in [SI measurement units](https://www.bipm.org/en/measurement-units/).
5//!
6//! ## Supported platforms
7//!
8//! * Linux 2.6.39+
9//! * MacOS 10.10+
10//! * Windows 7+
11//! * FreeBSD
12//! * DragonFlyBSD
13//! * NetBSD
14//!
15//! ## Examples
16//!
17//! For a quick example see the [Manager](struct.Manager.html) type documentation
18//! or [`simple.rs`](https://github.com/starship/rust-battery/blob/main/battery/examples/simple.rs)
19//! file in the `examples/` folder.
20//!
21//! [battop](https://crates.io/crates/battop) crate is using this library as a knowledge source,
22//! so check it out too for a real-life example.
23
24#![deny(unused)]
25#![deny(unstable_features)]
26#![deny(bare_trait_objects)]
27#![doc(html_root_url = "https://docs.rs/starship-battery/0.7.9")]
28
29#[macro_use]
30extern crate cfg_if;
31
32#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd"))]
33#[macro_use]
34extern crate nix;
35
36#[cfg(target_os = "netbsd")]
37extern crate plist;
38
39mod types;
40#[macro_use]
41pub mod units;
42pub mod errors;
43mod platform;
44
45pub use self::errors::{Error, Result};
46pub use self::types::{Batteries, Battery, Manager, State, Technology};