Skip to main content

module_config_required

Function module_config_required 

Source
pub fn module_config_required<T: DeserializeOwned>(
    provider: &dyn ConfigProvider,
    module_name: &str,
) -> Result<T, ConfigError>
Expand description

Strict configuration loader that requires configuration to be present.

This function enforces that configuration must exist and be valid:

  • If the module is not present → returns Err(ConfigError::ModuleNotFound)
  • If the module value is not an object → returns Err(ConfigError::InvalidModuleStructure)
  • If the module has no “config” field → returns Err(ConfigError::MissingConfigSection)
  • If “config” is present but invalid → returns Err(ConfigError::InvalidConfig)

Use this for modules that cannot operate without explicit configuration.

§Errors

Returns ConfigError if the module is not found, has invalid structure, or config is invalid.