MCPcopy Create free account
hub / github.com/PowerShell/DSC / new_from_json

Method new_from_json

lib/dsc-lib-registry/src/lib.rs:32–48  ·  view source on GitHub ↗

Create a new `RegistryHelper` from json. # Arguments `config` - The string with registry configuration information. # Errors `RegistryError` - The error that occurred.

(config: &str)

Source from the content-addressed store, hash-verified

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 ///

Callers

nothing calls this directly

Calls 3

JsonClass · 0.85
get_hive_from_pathFunction · 0.85
from_strFunction · 0.50

Tested by

no test coverage detected