Expand description
Code generation for #[lingxia::native] host handlers.
Scans Rust source files for #[lingxia::native("route")] / #[native("route")]
function attributes and pub struct definitions, then emits one of:
.ts— TypeScript client with typedinvoke/stream/channelbindings.js— browser global JS client.rs— Rust auto-register module (mod __lingxia_native { pub fn install() })
Intended as a build-dependency so build.rs can produce the artifacts during
cargo build, before the lxapp is assembled.
Functions§
- generate_
rust_ registry - Emit the Rust auto-register module that wraps every discovered handler’s
register_host_entry(...)call insidemod __lingxia_native { pub fn install() }.outmust end in.rs. - generate_
ts_ client - Emit the TypeScript (or browser-global JS) client for every
#[native]handler discovered underrust_dir. Output format is chosen by the extension ofout(.ts→ TS module,.js→ browser global).