Module yaml_util

Source
Expand description

Module that defines helper functions to process YAML configuration sources.

Functionsยง

fold_hash_until_first_err
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.
get_boolean_from_yaml_hash
Gets a specific boolean setting from a yaml hash
get_boolean_setting_from_context
Gets a boolean value for the setting named name.
get_boolean_setting_from_yaml_or_context
Gets a Boolean value from YAML or context.
get_integer_from_yaml_hash
Gets a specific integer setting from a yaml hash
get_integer_setting
Gets a Int value for the setting named name.
get_integer_setting_from_yaml_or_context
Gets a Integer value from YAML or context.
get_optional_string_array_from_yaml_hash
Gets a specific string array setting from a yaml hash, but if it is not found it returns an empty array.
get_setting_from_context
Gets a String value for the setting named name.
get_setting_from_yaml_hash
Gets a specific setting from a yaml hash
get_string_array_from_yaml_hash
Gets a specific string array setting from a yaml hash
get_string_content_or_keyed_value
Gets the content of this YAML node or the value for a specific key in it.
get_string_from_yaml_hash
Gets a specific string setting from a yaml hash
get_string_setting
Gets a String value for the setting named name.
get_string_setting_from_yaml_or_context
Gets a String value from YAML or context.
map_yaml_array
Calls a processing function on all elements of an array, will fail if any of the elements fail to process.
parse_as_array
Parse a yaml element as an array.
parse_as_boolean
Parse a yaml element as boolean.
parse_as_integer
Parse a yaml element as Integer.
parse_as_string
Parse a yaml element as string, will convert booleans and integers to string if necessary.
parse_as_string_array
Gets a native Vec<String> from a StrictYaml::Array. It errors out if the passed yaml is not an array or if not all the items in the array are plain StrictYaml Strings
process_value_from_yaml_hash
Gets the value for a specified key in a yaml hash and does something with it.
process_yaml_hash_until_first_err
Executes the process_function on each of the items in the yaml_hash. The yaml hash is assumed to be string keyed. It stops execution if any of the process functions returns an Error, and returns said error.
read_yaml_file
Reads a StrictYaml File. Returns Error in case of a syntax error.