Rust Anything: Port Your App to Rust Piece by Piece, Checked Against the Original
"Rewrite it in Rust" is easy to ask an AI. Proving the rewrite behaves the same is the hard part.
Rust Anything records what your existing code does, replays every recorded case against the Rust port, and only switches a port on when everything matches and a strict gate passes. You or your coding agent write the Rust; it decides when you are done.
The Loop for Every Unit
A port is done only when gate passes:
Run a real workload, rank the hot functions, and plan which units to port first and in what order.
Generate a Rust crate and a wrapper so callers keep the same API, then record what the original returns or throws on generated edge cases and your own tests.
Your agent writes src/port.rs; diff replays every recorded case and shows where the first difference is.
Time both sides including the bridge, and run them side by side before switching anything on.
Strict checks pass, then enable switches the port on for every caller; disable restores the original files byte for byte.
What gate Checks
From the documentation. A port that only memorizes the recorded answers does not pass.
| Check | What it means |
|---|---|
| Code quality | cargo fmt, clippy with -D warnings, tests and an unsafe-code audit |
| Error paths | A recorded failing case for every error path of the original; no unwrap/expect/panic where the original returns an error |
| Recording integrity | Not stale (original unchanged since record) and not altered (no cases edited or removed) |
| Cheat guard | Refuses answer tables, deleted failing tests and edited cases |
| Size | No more than 3x the original's lines plus 50 |
Language Support
| Language | Status and runtime |
|---|---|
| TypeScript / JavaScript | Verified on json-server, Fuse.js, vercel/ms and x18n; Node 22.6+ |
| Python | Supported; Python 3.9+ |
| C, Go, Ruby, Java | Supported; C compiler, Go 1.21+, Ruby 3+, JDK 17+ |
| PHP, C#, Kotlin, PowerShell | Preview |
Install and Port the Slow Part
npm install -g rust-anything && rust-anything setup
setup registers the MCP server and workflow skill with Claude Code, Codex, Cursor, Gemini CLI and OpenCode. Then run rust-anything go -- <slow command of your app> on a copy of the project with a test database: recording runs your real code on many inputs.
cargo install rust-anything
rust-anything record <crate>
rust-anything diff <crate>
rust-anything gate <crate>
rust-anything enable <crate> # disable <crate> to undo
When Rust Is Slower, and What It Does About It
Every call from JavaScript, Python or Go into Rust crosses a bridge, and runtimes like V8 run small functions in nanoseconds. So a small function called once per item is often slower after porting. The project publishes these results, including x18n's 29 ported functions being slower than TypeScript. profile finds the loop around such a function, --batch moves the whole loop into Rust, and go only switches on a port that is not slower for its callers.
A Green Gate Has Limits
Passing means the Rust matches every recorded case, nothing more. Behavior the recording never exercised can still differ. The docs have a "What it can't catch" page, and fuzz with --keep adds fresh inputs the recording missed. Coverage of the original's lines is reported so you can see how much the cases actually ran.
Limits to Plan Around
From the project documentation:
- Run it on a copy: record and app record call your real code on many inputs; anything that writes files, uses a database or calls the network does so once per case.
- Only as good as the recording: Behavior outside the recorded cases is not checked. Add your own tests with --from-tests and use fuzz.
- Not always faster: Per-call ports of small functions are often slower; follow bench's verdict.
- Young project: Created in November 2026. PHP, C#, Kotlin and PowerShell are still in preview.
MCP tools for every step plus a workflow skill for Claude Code, Codex, Cursor, Gemini CLI and OpenCode.
rustanything.ai, including real-world case studies with the slow results next to the fast ones.
MIT OR Apache-2.0. Ports and generated code in your repository are yours.
Frequently Asked Questions
Does Rust Anything translate my code to Rust automatically?
No. You or your coding agent write the Rust. Rust Anything profiles, plans, generates the bridge, records the original behavior, checks the port against it and decides when it is done.
Will my app always be faster in Rust?
No. A small function called once per item is often slower, because every call crosses the bridge, while V8, the JVM and Go run such functions in nanoseconds. Its bench step gives a verdict, and the go command only switches on a port that is not slower as its callers call it.
Is it safe to run on my production project?
Run it on a copy. record runs your original code on many generated inputs, so code that writes files, uses a database or calls the network does that once per case. The docs recommend a test database and no production credentials in the environment.
Which languages are supported?
TypeScript/JavaScript, Python, C, Go, Ruby and Java are supported; PHP, C#, Kotlin and PowerShell are in preview. Each needs its own runtime, for example Node 22.6+ for TypeScript or Python 3.9+.
