rust-lang / rust-lang/rust-bindgen

Support for zerocopy

Open
#2,168 12 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am looking to use the custom derive callbacks API to add zerocopy FromBytes and AsBytes derives to generated types. I have to rely on knowing exactly which types should derive these traits safely, as structs with pointers and certain unions cannot derive AsBytes and FromBytes.

Is there interest in building deeper support for zerocopy, since it is a useful trait for interacting with C APIs (mmap file, read struct). I don't know how "standard" zerocopy is within the ecosystem though.

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 by reading bindgen's custom derive callbacks API and the generated-type handling it exposes. Determine how zerocopy's FromBytes and AsBytes safety requirements could be represented for generated structs and unions, including types containing pointers. Done means an agreed scope and implementation approach for deeper zerocopy support.

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
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.