Closed webtransportbot closed 1 day ago
@webtransportbot the reason of the presence of the second trait is that it is mainly not for building the resulting WASM, but for generating IDL file which requires a crate with all services/program built. If the latter is not needed, then the second crate can be removed.
Another possible solution of having a single crate is building the app
crate using different targets, i.e. it can be built as cdylib for wasm32 and a regular binary for native targets. The latter can output IDL and can be executed as a part of build pipeline should the IDL is required
Problem to Solve
The current solution requires creating two crates for a single program:
The wasm crate is mostly boilerplate code, it would simplify the project structure if only one crate is needed per project
Possible Solution
Generate and build the wasm crate in app's build.rs script
Notes
No response