rustdv-gpi
Safe wrapper over the simulator programming interface (design-doc §3.3). Invariants upheld here so everything above is safe Rust:
- Handles are opaque and non-null; fallible acquisition is
Result. - Object-handle lifetime = simulation lifetime (freely
Copyable IDs). Callback handles invalidate on removal/fire — modeled by RAII ([CallbackHandle]): dropping an unfired handle removes the callback. - Strings are copied at the boundary, every call.
- No unwinding across FFI: every trampoline wraps the closure in
catch_unwind; panics are routed to the panic sink. - Callback user-data ownership: an
Rcwhose C-side reference is reclaimed exactly once (on fire for one-shots, on removal otherwise).
Thread affinity (§3.4): all types here hold raw pointers and are
therefore !Send/!Sync — the compiler rejects moving them off the
simulator thread.