Has anyone tried writing a Rust macro for candid that’s similar to sol!
from alloy_sol_macro?
The idea would be to have something like:
can!(
icp_ledger,
"../deps/candid/ryjl3-tyaaa-aaaaa-aaaba-cai.did"
);
And the macro creates a module icp_ledger
that contains generated Rust from the given candid file. At the minimum it would generate types, but it could also provide canister objects with async methods corresponding to the endpoints (like js-agent and Motoko do). It could also have different call implementations depending on the compilation target such that it works both on-chain and off-chain.
I think it would greatly simplify programming in Rust for ICP by removing a lot of manual work.
I remember there was some work done in generating Rust from Candid, but I cannot find it anymore. All search results I see are about generation of Candid from Rust.