Skip to content

Add a Rust binding emitter - #11

Open
magic-peach wants to merge 3 commits into
runtimeconditions:mainfrom
magic-peach:add-rust-binding-emitter
Open

magic-peach wants to merge 3 commits into
runtimeconditions:mainfrom
magic-peach:add-rust-binding-emitter

Conversation

@magic-peach

@magic-peach magic-peach commented Oct 20, 2026 •

Copy link
Copy Markdown

Adds a native Rust binding emitter under tooling/extension-bindings/emitters/rust/, following the structure of the TypeScript (#9) and Java (#10) emitters, and wires it into the orchestrator and generation workflow.

Emitter

  • emit, verify and api commands. verify re-renders the package from the model and requires every file to match, and parses the source with syn. --json prints errors as structured JSON.
  • Strict YAML profile and binding-model schema validation. RCR diagnostics carry a category, code, coordinate and JSON Pointer, and are documented in CONTRACT.md.
  • Generated crate: Cargo.toml, src/lib.rs, src/bindings.rs, one module per type under src/bindings/, and the binding manifest. Markers are traits with an rc_marker_<hex> method, objects are structs, unions are enums, and a reference is boxed only when it lies on a cycle.
  • Names are NFKC-normalized, and keywords become raw identifiers (r#type). Source is formatted with rustfmt, and every type and field has a doc comment naming its source. An optional serde feature adds derives.

Orchestrator and CI

  • rc bindings builds and runs the Rust emitter, assembles resources into runtimeconditions/, verifies with rustc, rustfmt and cargo check, and archives a deterministic zip. Rust releases record no profiler because none exists; the release schema forbids one for Rust.
  • packages.yaml has Rust entries for common-integrations and env-configuration. generate-rust.py, the binding-tools action and binding-generate.yml generate them like Go and Python.
  • New verify-rust-emitter job on Ubuntu and macOS, a languages.rust toolchain lock entry, and a placeholder crates.io publish workflow.
  • The manifest and release schemas accept language: rust.

Tests

cargo test and clippy pass. Conformance and first-party models are emitted three times byte-identically, verified, compiled as libraries and run through an exercise program that builds every type. Provider stub crates check imported markers, and a stub with a different marker method must fail to compile. Each crate passes cargo check with and without --features serde, and dependency-free crates round-trip every value through JSON. Negative fixtures check exact diagnostics, and a Go test covers the orchestrator pieces. The whole rc bindings pipeline (update, check, package) passes on the two Rust targets.

Not covered

Models using a JSON value skip the provider-stub variant, crates.io publication is a placeholder, and the released toolchain lock still needs a pinned emitter digest.

@magic-peach
magic-peach force-pushed the add-rust-binding-emitter branch from bf1f99a to 04e2d7a Compare October 20, 2026 16:55
@magic-peach
magic-peach force-pushed the add-rust-binding-emitter branch from 5eda3bd to 056e32c Compare October 23, 2026 18:20
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