Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Traits for working with config structs

We have a set of five traits that are used to provide the shared behaviour needed to parse, validate and execute rtf config files:

  • Template: used to locate and resolve templatable fields within larger config data structures.
  • Check: used to run side-effect free static analysis checks on config files before they are executed.
  • AsUtf8FileContent: used by providers that return a single string data file to define how their content is generated.
  • ResolveFileContent: used by providers that return multiple files to define how their content is generated.
  • ResolveAndWrite: used by providers to define how they generate their content and write it out to the user specified output directory.

All File Providers are required to implement the Template and Check traits and either the AsUtf8FileContent trait, the ResolveFileContent trait, or the ResolveAndWrite trait. You should prefer implementing AsUtf8FileContent where possible as it will handle some of the boilerplate logic for you.

This is possible whenever your provider is writing out a single utf8 encoded file as its output.