Support unions in `#[recursively_pinned]`, albeit without supporting pin-projection.

The rationale for why unions don't receive a `pin_project` function is documented here -- tl;dr we can't project because we can't know which field is active.

Users can just do it by hand, if they do know which field is active. Alternatively, we can add -- and this is still open even for structs -- we can add field-specific accessors, like `union U { x: i32, y: i64}` could have `project_x()` and `project_y()` functions.

The rationale for why we *should* support unions isn't documented, it's somewhat taken as a given, right? But like -- when this was originally written, I don't think I fully appreciated that this would be applied to literally every C++ type. And some features will apply to some types, and others to other types. For another example, I will be adding *pointer* projection in a followup CL, and that *will* support unions (but won't support enums!)  The only type that's going to have every single subfeature supported is likely going to be structs. :)

PiperOrigin-RevId: 450662659
4 files changed
tree: 3f1b65eae0340ed539cacaaba905c4b5b5e47592
  1. .bazelci/
  2. cc_template/
  3. common/
  4. docs/
  5. lifetime_annotations/
  6. migrator/
  7. rs_bindings_from_cc/
  8. .bazelrc
  9. .gitignore
  10. BUILD
  11. Cargo.Bazel.lock
  12. CODE_OF_CONDUCT
  13. CONTRIBUTING
  14. LICENSE
  15. README.md
  16. WORKSPACE
README.md

Crubit: C++/Rust Bidirectional Interop Tool

Extremely experimental interop tooling for C++ and Rust.

Please don‘t use, this is an experiment and we don’t yet know where will it take us. There will be breaking changes without warning. Unfortunately, we can't take contributions at this point.

Building Crubit

$ apt install clang lld bazel
$ git clone git@github.com:google/crubit.git
$ cd crubit
$ bazel build --linkopt=-fuse-ld=/usr/bin/ld.lld //rs_bindings_from_cc:rs_bindings_from_cc_impl