Candid to Rust binding
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Rust
- Stars
- 301
- Forks
- 85
- Avg merge
- 1h 4m
- Merged PRs (30d)
- 4
Description
There is no one-to-one mapping between Candid and Rust types.
- A candid type can map to multiple Rust types. For example,
vec record { text; int }can map toVec<(String, Int)>,HashMap<&str, Int>, or even&[Box<(Cow<str>, Arc<i128>)>]. - The fundamental difference between Candid typing and Rust is structural typing vs nominal typing. That is, when you create a struct/enum type in Rust, you have to give the type a name, which doesn’t necessarily exist in the did file, or may not the best name you want. There’s also the question of what traits to derive for each struct.
As a starting point, we can generate a simple binding with default types and let the users to adjust the binding by hand. To automate the customization, we can design a builder similar to https://docs.rs/prost-build/0.7.0/prost_build/struct.Config.html
TODO:
- design for config struct
- handle management canister for agent target
- detect if renaming collapse names
- non-blocking call for agent
- tests for golden files
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed default Candid-to-Rust bindings and the TODO list, beginning with the config struct design. The issue names no files or entry points; completion would require resolving the listed design, agent, naming, non-blocking call, and golden-file testing work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100