Observe item order in Rust source code generation.

I would also like to offer more examples for the ongoing discussion about what
kind of tests we want to write for source code generation. I have added
essentially the same kind of test written  in two different ways:

In `src_code_gen.rs` the unit test `test_item_order` mocks up an `IR` instance
and performs a targeted check that the generated functions and structs appear in
the expected order. To make writing tests like this comfortable we should have
helpers to build mock IR and perform checks against the generated source code.
The test contains very simple helpers that illustrate what I mean. I think
mboehme@ previously suggested something similar. If we want to write more tests
like this, this would need to be made more robust and flexible.

The other option is a golden test in `item_order.h` etc. That test was much
faster to write, but of course it has the usual pros and cons of golden tests.

I would like to suggest that we don't write tests in the style that we have been
using in `src_code_gen.rs` before, for example like `test_simple_struct` or
several others. Writing full IR without any helpers is very tedious, and also
brittle if we change the IR definition. And then, checking the whole output
against a `quote!{...}` invocation is essentially a golden file test that is
difficult to generate/update.

The final option is of course again `FileCheck` which we haven't configured,
yet.

PiperOrigin-RevId: 400670396
5 files changed
tree: b046f393bec1796f895c0b38ca57c4037a0b7430
  1. rs_bindings_from_cc/
  2. CODE_OF_CONDUCT
  3. CONTRIBUTING
  4. LICENSE
  5. README.md
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.