Skip to content

Add a C frontend and a Rust client - #18

Merged
dallison merged 4 commits into
mainfrom
rust
Oct 26, 2026
Merged

dallison merged 4 commits into
mainfrom
rust

Conversation

@dallison

Copy link
Copy Markdown
Owner

Summary

  • Add frontend = "c", which generates an opaque-handle C API (Foo.phaser.c.h) over the protobuf-style accessors. Each returned pointer owns a small heap handle; _free deletes that handle, and PhaserBytes.data is released with phaser_free.
  • rust = True builds a crate named <name>_rs that calls those C symbols through Rust FFI. Omitting frontend selects the C frontend. Nested handles borrow the parent.
  • Document the C and Rust clients, and the Python getter/setter module, in the README and user guide.

Test plan

  • bazel test //phaser/testdata:phaser_c_api_test //phaser/testdata:phaser_rust_test
  • bazel build //phaser/testdata:test_message_phaser //phaser/testdata:ros_compile_phaser
  • CI bazel test //... -//phaser:perf_test on Linux and macOS, including ASan and Valgrind

frontend=c emits an opaque-handle C API, and rust=True builds a safe crate on that API so other languages can use the protobuf-style accessors. The docs also cover the Python module.
Keep the Python client and the C/Rust frontend together, including both generators and both testdata targets.
rustc names libc before the C++ archives, so protobuf's atexit reference stays unresolved, and -nodefaultlibs never pulls in the ASan runtime. Ship Valgrind's suppressions with the C and Rust tests.
rust_test's platform transition ignores test tag filters, so mark the target incompatible when the asan config is on.
@dallison
dallison merged commit ea7926f into main Oct 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant