Skip to main content

runnable

Macro runnable 

Source
runnable!() { /* proc-macro */ }
Expand description

Declares a Pax UI that can be launched as an application or embedded in a host, using the selected root component and optional initializer.

ⓘ
pub mod ui;
pax_kit::runnable! { root: crate::ui::App, init: crate::ui::init }

init is an ordinary fn(&InitContext) -> AppResult<Root>; omitting it constructs Root::default(). Paths resolve at the declaration, and normal Rust visibility applies. Multiple declarations share one catalog; repeated roots are deduplicated and each root has one initializer. Select a root with InitOptions::entry when more than one is declared. Do not mix runnable! with #[main] in the same library.

Rust selects conditional source in each owning crate, including dependency features and custom cfgs. The macro compiles the selected program during ordinary Cargo compilation, without a user build script or nested build. Neither compilation nor dependency use evaluates initializers or mounts UI. Platform exports remain in the separately linked library cartridge. Direct pax-engine users can set engine_import_path: pax_engine.