extern crate starship_battery as battery; use std::io; fn main() -> battery::Result<()> { let manager = battery::Manager::new()?; let battery = match manager.batteries()?.next() { Some(Ok(battery)) => battery, Some(Err(e)) => { eprintln!("Unable to access battery information"); return Err(e); } None => { eprintln!("Unable to find any batteries"); return Err(io::Error::from(io::ErrorKind::NotFound).into()); } }; println!("{:?}", battery); Ok(()) }