As a developer, I want to extend config for header in rust bindings
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 301
- Forks
- 85
- Avg merge
- 1h 4m
- Merged PRs (30d)
- 4
Description
Is your feature request related to a problem? Please describe.
I want to update in config a header that affects the entire structure generated from candid.
let contents = candid::bindings::rust::compile(&config, &self.type_env, &None);
let mut lines = contents
.lines()
.skip(4);
lines.insert(0, "#![allow(dead_code, unused_imports)]".to_string());
lines.insert(1,"use candid::{self, CandidType, Deserialize, Principal, Encode, Decode};".to_string());
Describe the solution you'd like
I want to be able to change the following in header with option
- 'use' Declaration
- 'derive' of 'use' declaration
- (if possible) header comment
I have a few requests for structures as well.
- Whether the type, enum, and struct declarations in candid crate include modules or not
candid:Xxx or Xxx- Now only Principal is without module and the others contain module names.
- https://github.com/dfinity/candid/commit/fa29c70d31867cd98b5808e2fd050af547f213b0#diff-3c5bdad1fc69db86d5703bd188c015ceff01da3b9c0259b0c8f262629148a959L82-R117
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 at candid::bindings::rust::compile and inspect the Rust binding generation code, along with the linked commit diff for current declaration handling. Define how configurable use declarations, derives, header comments, and module qualification should work, then verify generated bindings for each supported option.
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
- Mostly clear
- Newbie friendliness
- 35/100