Skip to main content

build_with_specs

Function build_with_specs 

Source
pub fn build_with_specs(specs: impl IntoIterator<Item: AsRef<str>>)
Expand description

Scan the current crate and export the generated environment from multiple JSON configuration specs.

Each spec must be a JSON string with the following shape:

{
  "schema_version": 1,
  "functions": [
    { "pragma": "command" }
  ],
  "modules": [
    {
      "pragma": "plugin",
      "derives": [
        {
          "name": "logging",
          "functions": [
            "info",
            "warn",
            "error"
          ],
          "modules": [
            {
              "name": "http",
              "functions": [
                "request_started",
                "request_finished"
              ],
              "modules": []
            }
          ]
        }
      ]
    }
  ]
}

Fields:

  • schema_version: Must match SCHEMA_VERSION. This makes format changes explicit and lets builds fail early on incompatible config.
  • functions: Additional attribute names that should be treated like #[pragma(...)] on functions.
  • modules: Additional attribute names that should be treated like #[pragma(...)] on modules, together with optional nested derive configuration.
  • derives[*].name: Optional derive/module name.
  • derives[*].functions: Function names to expose under that derive node.
  • derives[*].modules: Nested derive modules with the same structure.