mirror of
https://github.com/aramperes/nut-rs.git
synced 2025-09-09 05:28:31 -04:00
version: 0.0.3
feat: list UPS variables docs: improve docs and enforce
This commit is contained in:
parent
b36c855b2c
commit
0ba5e4565f
8 changed files with 66 additions and 13 deletions
|
@ -23,11 +23,16 @@ fn main() -> nut_client::Result<()> {
|
|||
|
||||
let mut conn = Connection::new(config)?;
|
||||
|
||||
// Print a list of all UPS devices
|
||||
// Print a list of all UPS devices and their variables
|
||||
println!("Connected UPS devices:");
|
||||
for (id, description) in conn.list_ups()? {
|
||||
println!("\t- ID: {}", id);
|
||||
for (name, description) in conn.list_ups()? {
|
||||
println!("\t- Name: {}", name);
|
||||
println!("\t Description: {}", description);
|
||||
println!("\t Variables:");
|
||||
|
||||
for (var_name, var_val) in conn.list_vars(&name)? {
|
||||
println!("\t\t- {} = {}", var_name, var_val);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue