Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

google/crubit — A bidirectional bindings generator for C++ and Rust.

Description and use

**Brief Summary**
google/crubit is an open‑source tool that automatically generates bidirectional bindings between C++ and Rust, letting developers call C++ code from Rust and vice‑versa without writing the glue code by hand. With over a thousand stars and recent activity, it can speed up cross‑language prototyping, especially in teams that already use both languages.

**Value**

  • **Time‑saving**: Generates the boilerplate for FFI, reducing manual extern "C" declarations, #[repr(C)] structs, and build‑system tweaks.
  • **Consistency**: Guarantees that the generated signatures stay in sync with the source APIs, lowering the risk of mismatched types or calling‑convention bugs.
  • **Bidirectional**: Supports both “Rust‑calls‑C++” and “C++‑calls‑Rust” scenarios, which is rare among FFI generators.

**Practical Adoption Path**

  1. **Prototype** – Clone the repo, run the provided crubit CLI on a small C++ library, and verify the generated Rust bindings compile.
  2. **Code Review** – Manually inspect the generated code for safety‑critical sections (e.g., ownership semantics, unsafe blocks) and adjust annotations as needed.
  3. **CI Integration** – Add the crubit step to your build pipeline (e.g., as a cargo or bazel rule) so bindings are regenerated on every change.
  4. **Dependency Check** – Ensure the required toolchain (LLVM/Clang, Rust 1.70+, and any optional bazel rules) is available and that the generated code does not introduce unwanted transitive dependencies.

**Production Readiness**

  • **Maturity**: Medium. The project is actively maintained (last commit 2026‑05‑11) and has a healthy star/fork count, but integration signals are sparse and no formal LTS release exists.
  • **Suitability**: Good for internal tools, prototypes, or services where you control both the C++ and Rust codebases. Before shipping to production, perform a security audit of the generated unsafe code, verify the licensing (Apache‑2.0 compatible), and confirm that the maintainers respond to issues relevant to your use case.
  • **Risk Mitigation**: Pin the crubit version in your dependency lock file, add regression tests for the generated bindings, and schedule periodic reviews of upstream changes.

In short, google/crubit can dramatically simplify C++/Rust interop, but it should be introduced behind a review gate and monitored as part of your CI/CD process before being considered production‑grade.

Problem

google/crubit may be useful when its README and activity match a concrete workflow.

Outcome

Medium: useful for prototypes or internal workflows, with dependency and maintenance checks before production.

Evidence

A bidirectional bindings generator for C++ and Rust.

Source

  • Record date: 2026-09-20T06:15:55.557Z