I have the below code using the WinReg crate. I'm trying to get rid of all "unwrap"s. Not sure how to do this inside a closure. Appreciate any help to educate me on this and thanks.
// collect all values from a given reg key
fn get_reg_values(hive: &str, hkey: &RegKey, key: &str) -> std::io::Result<()> {
let n = match hkey.open_subkey(key) {
Ok(n) => n,
_ => return Ok(()),
};
let lwt = get_reg_last_write_time(&n)?;
for (name, value) in n.enum_values().map(|n| n.unwrap()) {
print_value(hive, key, name, &value.bytes, format!("{:?}", value.vtype), &lwt)?;
}
Ok(())
}