Generate R code containing the complete program artifact and its restoration call. This preserves nested graphs and exact schemas without hand-rendering module fields.
Usage
export_module_code(
module,
name = "mod",
include_demos = TRUE,
file = NULL,
registry = list(),
trusted = FALSE
)Arguments
- module
A DSPrrr module to export.
- name
Character; variable name for the module in generated code. Default is "mod".
- include_demos
Logical; whether to include demonstration examples in the generated code. Default is TRUE.
- file
Optional file path to write the code to. If NULL (default), returns the code as a character string. Existing files are atomically replaced only after the staged output parses successfully.
- registry
Named runtime registry; see program-artifact.
- trusted
Whether trusted runtime values may be embedded. Standalone code export rejects registry and embedded runtime references.
Value
If file is NULL, returns the R code as a character string. If
file is specified, writes it atomically and returns the code invisibly.
See also
Other optimizer accessors:
apply_best_config(),
best_demos(),
best_params(),
config_diff(),
optimization_summary(),
top_trials()