rust-lang / rust-lang/rust-bindgen

Feature request: Customize pointer types

Open
#2,023 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

I'd like to be able to customize the types of pointer types generated by bindgen. That is, the input:

struct foo {
    int *bar;
};

would produce the output:

struct foo {
    pub bar: CustomPointer<::std::os::raw::c_int>,
}

where CustomPointer is an arbitrary type path specified in configuration.

The idea here is the custom pointer type can be a safe transparent wrapper around an integer value, which can e.g. treat the pointer as belonging to another process and read it from there.

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

No file, test, or entry point is named in the issue. Start by tracing bindgen's pointer-type generation and configuration handling; done means a configured arbitrary type path produces the requested custom pointer type for the shown input, with coverage for the generated output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, 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.