Skip to main content

LumenWatchFn

Type Alias LumenWatchFn 

Source
pub type LumenWatchFn = unsafe extern "C" fn(name: *const c_char, value: *const LumenValue, user_data: *mut c_void);
Expand description

Signal-change subscription callback (ABI 0.4). Registered with lumen_signal_watch; fires once per tick in which the watched global signal’s committed value changed (plus once on the first tick the value is observed after the watch is registered).

name is the watched signal name (UTF-8, NUL-terminated). value points to the new committed value, borrowed for the duration of the call - Lumen frees it afterwards, so copy anything you keep. The LumenValue mirrors the stored PropertyValue: Bool->LUMEN_BOOL, I64->LUMEN_INT, F64->LUMEN_FLOAT, Str->LUMEN_STRING, and Color->LUMEN_INT packed big-endian 0xRRGGBBAA (unpack channels with (v>>24)&0xffv&0xff). Other variants (Vec2, Custom) arrive as LUMEN_NIL.

Fires on the Lumen tick thread (same Send/Sync user_data contract as lumen_app_expose). Delivery is per-tick coalesced: several mid-tick writes collapse into a single callback carrying the final value, mirroring [PropertyStore]’s own GObject-style notify semantics.