Expand description
ConstructorBuilder — the shared lowering for DefConstructor.
Both binding front-ends target this one builder, so they cannot drift:
- the compile-time
DefConstructor!macro (latexml_engine), and - the runtime Rhai script layer (
latexml_contrib::script_bindings).
It is front-end-agnostic: it takes already-native values and closures, so it
lives in latexml_core and pulls in neither the macro machinery nor Rhai.
Two kinds of options, by how much can be shared:
- Scalar options (
mode,bounded, …) go through one genericConstructorBuilder::set_option— the key→field mapping lives in exactly one place, so adding a scalar option updates both front-ends at once. - Closure options (
afterDigest, …) have typed setters: the field andinstallare shared, while the closure itself is produced by whichever front-end (a macro$body:block, or a Rhai trampoline).
Structs§
- Constructor
Builder - Accumulates a constructor definition and installs it via
def_constructor. - Environment
Builder - Accumulates an environment definition and installs it via
def_environment— the environment analog ofConstructorBuilder, sharing the same option machinery. The prototype is theDefEnvironment!shape:"{name}"or"{name}{}…"(env name in braces, then the parameter list).
Enums§
- Option
Value - A scalar option value handed to
ConstructorBuilder::set_option. Both front-ends produce these (the macro from a literal, Rhai from aDynamic), so the key→field switch is single-source.