Initial commit

This commit is contained in:
tkl
2021-06-25 05:07:51 +00:00
committed by Thomas Klaehn
commit dccb1ccf9f
5 changed files with 145 additions and 0 deletions

11
examples/bat0.rs Normal file
View File

@@ -0,0 +1,11 @@
use linux_battery;
fn main() {
let mut battery = linux_battery::Battery::new("BAT0");
let mut msg = format!("Status: {}", battery.state());
match battery.capacity() {
Some(cap) => msg = format!("{}\tCapacity: {} %", msg, cap),
None => {},
}
println!("{}", msg);
}