Targets · Rust · Keywords

Keywords

How each of Program's keywords is rendered into Rust.

Contents

How a Program becomes Rust, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.

Program keywords in Rust

Each of Program's keywords maps to idiomatic Rust. Names nest through mods joined with :: (see the example); the reactive keywords are calls into the runtime. Follow a keyword's own page for the full rendering and the other targets.

KeywordRendered Rust
MODULEA nested mod, snake_case — Ui.Button.Integer becomes ui::button::integer.
TYPEA record becomes pub struct Point { pub x: f64, pub y: f64 }; a union becomes pub enum Shape { Circle(Circle), Rect(Rect) }.
FUNCTIONpub fn Name(…) -> ReactiveValue<T> { … }.
NATIVEA pub fn whose body is the rust NATIVE string.
INPUTA parameter; a BINDING input is read and written.
HOLEA Box<dyn Fn(…)> callback parameter.
LETlet name = …;.
STATElet name = Reactive::state::<T>(value);.
REVERSEA write-back whose closing SET is Reactive::set(state, value).
WITHmodule::with(name, replacement, Box::new(move || { … })).

See JavaScript keywords for the per-keyword detail and the modifiers; Rust differs in idiom (snake_case modules, boxed closures) but the mapping is the same.