pub fn install()Expand description
Make Material 3 this app’s starting design system.
Two process-global pushes, both public frust seams:
frust::set_default_theme(baseline())— the base a shell seeds itself with instead of its built-inTheme::neutral()fallback. Deliberately notfrust::set_app_theme: a seeded default does not pin brightness, so an app installed this way still follows system dark mode.frust::register_app_fontsfor both bundled faces (Roboto Flex, Roboto Mono), so the type scale’s Roboto Flex stack and any mono-text component actually resolve. The faces are compiled in behind the crate’sbundled-fontsfeature (default on); an app that setsdefault-features = falseon this dependency compiles in no font bytes,install()registers neither face, and text falls back to the platform’s system faces through fontique (Roboto on Android).
§Timing: must run before the first frame
A shell reads the default-theme slot and drains the font registry once, at
construction, before its first rebuild. A call after that takes effect only
on a later clear_app_theme-driven reseed, which may never happen — so a late
call silently does nothing visible.
The supported way to get the timing right on all three platforms is
frust::app!’s setup block, which runs immediately before the root
component’s Component::init and therefore before any shell construction —
see the crate docs for the full example.
§Thread contract and repeat calls
Both underlying seams are plain Mutex-guarded process-globals callable from
any thread. Calling install twice is harmless but wasteful: the second
set_default_theme replaces an identical value, and the font bytes are pushed
(and later re-registered, shadowing the same family names) a second time. Call
it once.