Skip to main content

Module probe

Module probe 

Source
Expand description

Palette-consumption probe — the machine-readable witness that a component consumed the active Theme. theme records the palette name it returns here; a headless test resets the probe, renders one component, then reads painted to assert the component painted with the palette it was given (not default). Thread-local so parallel test cells don’t interfere; cheap (a Cell), and a no-op cost for production renders that never read it.

Functions§

painted
The palette name the most recent theme call handed out on this thread, or None if nothing has read the theme since reset. A component that paints with the active palette returns Some(palette_name).
record
Record the palette a theme call handed out. Called from inside theme(ui); the last palette read this paint wins (a facet may read the theme several times — they’re all the active palette).
reset
Clear the probe before rendering a component, so painted reflects only that component’s paint.