Skip to main content

Module rpc_schema

Module rpc_schema 

Source
Expand description

Edge RPC schema emitter (issue #548 AC1 + AC4).

Walks the ssg_rpc dispatch inventory at build time and writes a TypeScript declaration file at dist/.ssg/rpc.d.ts. The matching JS client (web/rpc.js) consumes that file via a TS users import.

§Wiring

The plugin is registered unconditionally in Plugins::build, but it is a no-op when zero #[ssg_rpc]-annotated functions are reachable from the binary (which is the case for ssg itself — users add the macro in their own crates that pull ssg-rpc).

§Why a plugin and not a build.rs?

Because the inventory only contains functions that are reachable from the final binary. build.rs runs at compile time when the user’s RPCs are not yet linked. The plugin runs at the same lifecycle stage as the ISR manifest emitter, which means the dist/.ssg/ directory it writes into is already created.

Structs§

RpcSchemaPlugin
after_compile plugin that emits dist/.ssg/rpc.d.ts.

Constants§

RPC_DTS_RELATIVE_PATH
Relative path inside dist/ where the schema is written.