pub fn read_config_file(filename: String) -> Result<ConfigData, ConfigError>Expand description
Loads configuration data from a specified .toml file into a ConfigData struct.
This version of the function is intended for production environments. It reads
the entire content of the .toml file and then attempts to parse it into the
ConfigData structure.
§Arguments
filename- The fully qualified path (including directory and file name) of the.tomlconfiguration file to be read.
§Returns
A Result containing a ConfigData struct with the parsed configuration on success.
§Errors
Returns a ConfigError variant if any part of the process fails:
ConfigError::FileRead: If the specified file cannot be read from the filesystem. This can be caused by the file not existing, or the application lacking the necessary permissions to access it.ConfigError::TomlParse: If the file’s content is not valid TOML, or if its structure does not match theConfigDatastruct, preventing deserialization.