Skip to main content

parse_to_hashmap

Function parse_to_hashmap 

Source
pub fn parse_to_hashmap(ccl_content: &str) -> Result<HashMap<String, Value>>
Expand description

Parse CCL string into a HashMap where values can be either arrays or objects

With sickle, this function directly deserializes CCL into proper Value types.

ยงExamples

use santa_data::parse_to_hashmap;
use serde_json::Value;

let ccl = r#"
simple_pkg =
  = brew
  = scoop

complex_pkg =
  _sources =
    = brew
  brew = gh
"#;

let result = parse_to_hashmap(ccl).unwrap();
assert!(result.contains_key("simple_pkg"));
assert!(result.contains_key("complex_pkg"));