Initial commit
This commit is contained in:
11
examples/bat0.rs
Normal file
11
examples/bat0.rs
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user