Skip to main content

eval_modules

Function eval_modules 

Source
pub fn eval_modules(
    modules: &[Module],
    option_types: &[OptionTypeSpec],
) -> Result<Config, SpecError>
Expand description

Evaluate a list of modules + their option-type registry, and return the merged config. M2.0 implementation: covers LastWins (bool, int, str, path, package, null), Concatenate (listOf), AttrsetMerge (attrsOf, attrs), and priority resolution (mkForce < normal < mkDefault). Submodules + recursion + transitive imports are M2.1 work.

§Errors

  • SpecError::Interp { phase: "type-check" } if a definition’s value doesn’t satisfy its option’s declared type.
  • SpecError::Interp { phase: "unknown-type" } if a module declares an option whose type_name isn’t in the registry.
  • SpecError::Interp { phase: "unknown-option" } if a config definition references an option path that wasn’t declared by any module.
  • SpecError::Interp { phase: "merge-conflict" } if a non- mergeable type sees multiple definitions at the same priority.