4 ms·
There are a few opportunities for code generation here. The server.rs looks like an implementation of RPC over websockets. So a refactoring might be to model t
by 1ba9115454 7y ago
There are a few opportunities for code generation here.
The server.rs looks like an implementation of RPC over websockets. So a refactoring might be to model the interface using something like https://grpc.io/ https://grpc.io/ or any other IDL then code generate Rust server stubs and Typescript client stubs.
Cargo has a mechanism for this. https://doc.rust-lang.org/cargo/reference/build-scripts.html https://doc.rust-lang.org/cargo/reference/build-scripts.html
The other area where there is some boiler plate is the Diesel ORM. Diesel does generate some code ie. schema.rs but you are left to write the structs that implement these as well as Form structs for passing data to Diesel.