Function dotfiles_core::yaml_util::fold_hash_until_first_err
source · pub fn fold_hash_until_first_err<T, P, Processed, F>(
yaml: &StrictYaml,
init: Result<T, DotfilesError>,
process_function: P,
fold_function: F
) -> Result<T, DotfilesError>where
P: FnMut(String, &StrictYaml) -> Result<Processed, DotfilesError>,
F: FnMut(T, Processed) -> Result<T, DotfilesError>,
Expand description
Process each element of the hash with the process_function
and then fold them all using into a
single result using fold_function
, for an initial value of init
. Returns the first error
that happens in either processing or folding.
§Errors
- ErrorType::UnexpectedYamlTypeError if the yaml passed in is not a hash
- ErrorType::UnexpectedYamlTypeError if the hash contains keys that cannot be parsed as strings.
- Any errors from the fold_function or process function.