pub(crate) fn parse_rules<P: AsRef<Path>>(rules_path: P) -> Result<Vec<RagenixRule>> {
    let instance = nix_rules_to_json(&rules_path)?;

    // It's fine to force unwrap here as we validated the JSON schema
    let mut rules: Vec<RagenixRule> = Vec::new();
    for (rel_path, val) in instance.as_object().unwrap().iter() {
        let dir = fs::canonicalize(rules_path.as_ref().parent().unwrap())?;
        let p = dir.join(&rel_path);
        let public_keys = val.as_object().unwrap()["publicKeys"]
            .as_array()
            .unwrap()
            .iter()
            .map(|x| x.as_str().unwrap().to_string())
            .collect();
        let rule = RagenixRule {
            path: p,
            public_keys,
        };
        rules.push(rule);
    }

    Ok(rules)
}
/// Parse the given rules file path.
///
/// This method assumes that the passed file adheres to the [`AGENIX_JSON_SCHEMA`].
Parse the given rules file path.
This method assumes that the passed file adheres to the [`AGENIX_JSON_SCHEMA`].
Parse the given rules file path . This method assumes that the passed file adheres to the [ ` AGENIX_JSON_SCHEMA ` ] .
pub(crate) fn parse_rules<P: AsRef<Path>>(rules_path: P) -> Result<Vec<RagenixRule>> {
    let instance = nix_rules_to_json(&rules_path)?;
    // It's fine to force unwrap here as we validated the JSON schema
    let mut rules: Vec<RagenixRule> = Vec::new();
    for (rel_path, val) in instance.as_object().unwrap().iter() {
        let dir = fs::canonicalize(rules_path.as_ref().parent().unwrap())?;
        let p = dir.join(&rel_path);
        let public_keys = val.as_object().unwrap()["publicKeys"]
            .as_array()
            .unwrap()
            .iter()
            .map(|x| x.as_str().unwrap().to_string())
            .collect();
        let rule = RagenixRule {
            path: p,
            public_keys,
        };
        rules.push(rule);
    }
    Ok(rules)
}
pub ( crate ) fn parse_rules < P : AsRef < Path > > ( rules_path : P ) -> Result < Vec < RagenixRule > > { let instance = nix_rules_to_json ( & rules_path ) ? ; // It's fine to force unwrap here as we validated the JSON schema let mut rules : Vec < RagenixRule > = Vec :: new ( ) ; for ( rel_path , val ) in instance . as_object ( ) . unwrap ( ) . iter ( ) { let dir = fs :: canonicalize ( rules_path . as_ref ( ) . parent ( ) . unwrap ( ) ) ? ; let p = dir . join ( & rel_path ) ; let public_keys = val . as_object ( ) . unwrap ( ) [ " " ] . as_array ( ) . unwrap ( ) . iter ( ) . map ( | x | x . as_str ( ) . unwrap ( ) . to_string ( ) ) . collect ( ) ; let rule = RagenixRule { path : p , public_keys , } ; rules . push ( rule ) ; } Ok ( rules ) }
Parse the given rules file path.
Parse the given rules file path .
rules_path
P