Skip to main content

Module wasm

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§

WasmPainter
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 name drawn by the painter module bytes (load), ready to register (super::register_painter_set).