dfinity / dfinity/candid

As a developer, I want to extend config for header in rust bindings

Open
#495 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.