Expand description
AOT compiled-app artifact - the on-disk product of lumenc build.
Today lumenc run parses main.lmn + main.css from source on every
launch. The AOT model resolves that work once at build time and bakes
the result - a fully cascaded LayoutIR plus the combined script
source - into a compact binary blob the runtime deserializes directly,
with the markup parser removed from the shipped binary (see the
runtime-parse cargo feature).
This mirrors how other toolkits ship compiled UI:
- Qt precompiles
.qmlinto bytecode viaqmlcachegen/ the QML disk cache and bakes it into the binary, so the QML parser need not run (or even ship) at launch. This module is the direct analogue: the artifact is Lumen’s “QML cache”. - Slint compiles
.slintto Rust at build time. We keep Lumen’s model data-driven rather than codegen (an artifact, not generated Rust) so the same runtime consumes it - but the “resolve markup once at build time” principle is identical.
Where these conflict with Lumen philosophy, philosophy wins: the artifact
carries the design-token-reachable cascaded stylesheet
(LayoutIR::combined_stylesheet) verbatim, so colors/metrics stay
CSS-reachable at runtime (the <for> reconciler re-applies it) - the AOT
step resolves the cascade, it does not freeze visuals into hardcoded
values.
§Container layout
magic : 4 bytes b"LMNA" (Lumen Markup Native Artifact)
version: 2 bytes u16 LE (FORMAT_VERSION)
body : bincode(CompiledApp)bincode is used over RON/JSON because the artifact is shipped/embedded and binary size is the priority: bincode stores no field names or schema, so a cascaded stylesheet with hundreds of declarations costs a fraction of its textual form. The magic + version prefix lets the loader reject a stale or foreign file cleanly instead of failing deep inside the decoder.
Structs§
- Compiled
App - The precompiled application: everything the runtime needs to spawn the UI without touching the markup / CSS parser.
- Compiled
I18n - The app’s translations, as baked at build time.
- Compiled
Pages - The navigable page set of a compiled multi-page app.
- Compiled
Script - One language’s whole program, as baked at build time.
- Unlinked
Capability - One optional subsystem an app’s engine was linked without.
Enums§
- Artifact
Error - Errors from (de)serializing or reading/writing an artifact.
Constants§
- FORMAT_
VERSION - Container format version. Bump on any incompatible change to
CompiledAppor the framing. The loader refuses mismatches so a runtime never mis-decodes an artifact built by a different toolchain. - MAGIC
- Container magic - “Lumen Markup Native Artifact”.
Functions§
- deserialize
- Deserialize framed container bytes back into a
CompiledApp, validating the magic and version first. - read
- Read and decode an artifact from
path. - read_
bytes - Decode an artifact from an in-memory byte slice: the byte-slice
counterpart of
read. Used by the link-not-embed launcher path, where the compiler produces LMNA bytes in-process and hands them across the C-ABI (lumen_app_new_from_lmna) instead of writing a file. Thin alias overdeserialize; validates magic + version identically. - serialize
- Serialize a
CompiledAppinto the framed container bytes. - write
- Write an artifact to
path.