module

Egui::Reactive

Class-body macros for reactive fields (included in Egui::App).

Macros

computed(decl)

computed doubled : Int32 = count * 2 — a memoized derivation from signals/other computeds. The declaration form is required (not a block): Crystal cannot infer an instance-variable type from a method-call expression, and the annotated value ivar gives change detection a typed old/new pair for free. The block re-runs only when a dirty result is read; a recompute yielding the old value does not propagate further.

Source
reactive(decl)

reactive count = 0 or reactive speed : Float64 = 0.3 — @count : Signal(Int32) plus a plain-looking getter/setter pair. The ivar carries an explicit type argument: Crystal cannot infer a generic's type argument from constructor arguments in an instance-variable default, so the literal forms are mapped inline above and everything else goes through the name : Type = default form.

Source