theme_roots
module · ferroui-build · v0.5.0
module theme_roots
The units of the themes an application keeps (#568, steps 3 and 4 of docs/porting/theme-trimming.md): the opt-in of the application, its roots, and the closure of the roots over the unit graph of a theme.
Not a port of an upstream file. A theme whose compiled markup is partitioned into units states
its unit graph in its .xamlmeta (theme_units: for each unit the keys and type keys it
defines, the keys it references and the types it constructs or selects). An application (unless
[package.metadata.ferroui] theme-trimming = false in its manifest turns it off) constructs the
theme from the units its build computes here:
- Roots. The types the compiled documents of the application construct, select or name in
{x:Type}, with their base classes (from the type models); every token of the documents that may name a key; the names oftheme-roots = ["Name", ..](a unit, by the path of its document, or a type or a key); the names and string literals of the Rust sources of the application (source_roots: a name that is a type key or a class, a string that is a key); and the roots a build script adds (Roots::extend).theme-roots = "all"and a build withferroui-base/full-themes(DEP_FERROUI_BASE_XAML_FULL_THEMES: the run-time loader, hot reload, the designer, DevTools, Inspect) keep every unit. What the compiled documents of the dependencies name is a root too (thereferencesof their.xamlmeta). - Live types. A live type makes its base classes live, and the classes its code creates
(the creates edges of the type models,
TypeModel::creates:ListBoxcreatesListBoxItem), transitively (TypeGraph::live). - Closure. The ambient unit (index 0) is always kept. A unit is kept when it defines a live
key or the type key of a live type, or is named. A kept unit makes its references live keys
(
StaticResource,DynamicResource,BasedOn,Themeand every other mention of a key) and its types live types: the types its templates construct root their own control themes.
The result is the canonical indices of the kept units, ascending: the order of the table the
build writes and with_parts takes.
Contents
MANIFEST_TABLE— constantTRIMMING_KEY— constantROOTS_KEY— constantCOMPILE_BINDINGS_KEY— constantcompile_bindings_from_manifest— functionThemeTrimming— structRoots— structTypeGraph— structsource_roots— functionkept_units— functionparts_static_name— functionunit_static_path— function
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.