Module wasm
Expand description
Painter sets loaded from wasm: a theme’s own painters, run in the UI host
with nothing to reach (docs/architecture/theming.md, “Part painters”).
A module built against tilo_theme_sdk (export_painter!) exports a
buffer and one call, and imports nothing; load refuses one that
imports anything, so a painter has no clock, no I/O, no files and no
host to ask. Each call runs on the interpreter (wasmi) with a fuel
budget and the module’s memory capped, and its answer is decoded as
untrusted bytes ([tilo_theme_sdk::wire]). The set is then a
PartPainter like the built-in ones and draws through the same host
(super::paint_part): one path, whoever wrote the painter.
A call that traps, runs out of fuel or answers malformed bytes is a
part the set leaves to the toolkit (None, drawn by the Default set);
a set that traps is not called again, so a broken painter costs one
frame’s budget, not one per frame.
Structs§
- Wasm
Painter - A painter set running in wasm.
Enums§
- Refusal
- Why a module is not a painter set.
Constants§
- FUEL_
PER_ CALL - Fuel one call may burn: well past what any part takes to draw (a dithered panel is a few hundred thousand), short enough that a looping painter is stopped within a frame.
- MAX_
ANSWER - Largest answer the host reads, bytes.
- MAX_
MEMORY - Linear memory one set may hold, bytes.
Functions§
- load
- Load the painter module
bytes: validated, refused if it imports anything, started under the call budget, and asked for its parameters. - painter_
set - The set
namedrawn by the painter modulebytes(load), ready to register (super::register_painter_set).