macro_rules! declare_node_app {
($app_type:ty) => { ... };
}Expand description
Generate all FFI boilerplate for a NodeApp implementation.
This macro creates:
- A
OnceLock<RwLock<T>>instance for the app (sound concurrent access). - A call gate: the shutdown entry calls
NodeApp::begin_shutdownat once, refuses new calls withERROR_SHUTTING_DOWN, and takes the write lock forNodeApp::shutdownonly after in-flight calls return. - The
_node_app_entryexport symbol returning aNodeAppVTable. - FFI wrapper functions for
init,shutdown,handle_request,handle_event,handle_capability, andfree. catch_unwindguards on every FFI boundary to prevent UB from panics crossing the Rust/C ABI.- Thread-local trace span management around
handle_capability.
Invoke once at the crate root after defining the app type:
ⓘ
declare_node_app!(MyApp);