Create a new `RegistryHelper` from json. # Arguments `config` - The string with registry configuration information. # Errors `RegistryError` - The error that occurred.
(config: &str)
| 30 | /// |
| 31 | /// * `RegistryError` - The error that occurred. |
| 32 | pub fn new_from_json(config: &str) -> Result<Self, RegistryError> { |
| 33 | let registry: Registry = match serde_json::from_str(config) { |
| 34 | Ok(config) => config, |
| 35 | Err(e) => return Err(RegistryError::Json(e)), |
| 36 | }; |
| 37 | let key_path = registry.key_path.clone(); |
| 38 | let (hive, subkey) = get_hive_from_path(&key_path)?; |
| 39 | |
| 40 | Ok( |
| 41 | Self { |
| 42 | config: registry, |
| 43 | hive, |
| 44 | subkey: subkey.to_string(), |
| 45 | what_if: false |
| 46 | } |
| 47 | ) |
| 48 | } |
| 49 | |
| 50 | /// Create a new `RegistryHelper`. |
| 51 | /// |
nothing calls this directly
no test coverage detected