# Navi Rust Bindings

Autogenerated Rust data structures that mirror Navi-Core message payloads so your application can parse or emit Navi telemetry.

## Install

Add the crate to your Cargo manifest:

```toml
[dependencies]
navi-rust-bindings = "0.1"
```

## Use

Every payload struct lives at the crate root and derives `serde::Serialize`/`Deserialize` for easy encoding:

```rust
use navi_rust_bindings::NaviOutputPayload;
// work with NaviOutputPayload
```

## Publishing to crates.io

These bindings can be generated from `.reg` files under `include/navi/core/registry/register_map`.

1. Regenerate with the desired version (updates `Cargo.toml`, `lib.rs`, `mod.rs`, `src/gen`, and `LICENSE`):

   ```bash
   python3 tools/generate_register_rust_crate.py --crate-version <M.m.p>
   ```

2. Verify the crate packages cleanly (fails if generated files are stale or metadata is invalid):

   ```bash
   cd bindings/rust
   cargo package
   ```

3. Publish once the package check passes. Authenticate with `cargo login <token>` once per machine or set `CARGO_REGISTRY_TOKEN`, then:

   ```bash
   cargo publish
   ```

> [!TIP]
> visit [crates.io](https://crates.io/) for the token, and try running `cargo publish --dry-run`

The GitHub workflow `.github/workflows/check-registers-rust-crate.yml` enforces that generated artifacts stay in sync in pull requests; you should see a clean `git status` for `bindings/rust` before tagging, publishing, and creating PR.
