Created
September 9, 2023 11:53
-
-
Save TomerCohen95/bc755be2127ff001b1a61d7ae3a4f902 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn log(value: &String) -> Result<(), LoggingError> { | |
if value.len() > 10 { | |
return Err(LoggingError::TooLong); | |
} | |
println!("{}", value); | |
Ok(()) | |
} | |
fn get_registry_value(key_path: &str) -> Result<String, io::Error> { | |
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE); | |
let key = hklm.open_subkey(key_path)?; | |
let value: String = key.get_value("my_key")?; | |
log(&value)?; | |
Ok(value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment