cholcombe973 / block-utils

Rust utilities for working with block devices
MIT License
22 stars 17 forks source link

fix return of get_*_log functions in nvme module - issue 42 #43

Closed robsonsmartins closed 1 year ago

robsonsmartins commented 1 year ago

Fixes issue #42.

Changed the return of functions get_error_log(), get_firmware_log() and get_smart_log() to serde_json::Value.

In addition to correcting the mismatched return type error (Map isn't a String), the user will be able to call something like this:

let log = get_firmware_log(&device_path).expect("error getting log");
println!("temp: {:.2} ºC", log.get("temperature").and_then(Value::as_f64).unwrap_or_default() - 273.15);