vnhax
erkamyaman / rust-anything
View on GitHub ↗

Independent review by VNHAX. Not affiliated with or endorsed by the project's authors.

#1 RUST REPO OF THE WEEK (TRENDSHIFT)RECORD · DIFF · GATETS · PYTHON · GO · C · RUBY · JAVAMCP SERVER + AGENT SKILLMIT OR APACHE-2.0
Rust Anything: an app goes through profile, record, bridge, diff, bench and gate steps until a Rust port matches the original
erkamyaman / rust-anything — rewrite in Rust and prove it still behaves the same

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.

128.6 s → 6.9 s
Prettier on 2,360 files
Byte-identical output (project result)
74 → 3.5 MB
json-server idle memory
514 of 514 HTTP cases matching (project result)
0.56x
vercel/ms per call
Slower, and the project publishes it
HOW IT WORKS

The Loop for Every Unit

A port is done only when gate passes:

profile → analyze

Run a real workload, rank the hot functions, and plan which units to port first and in what order.

bridge → record

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.

port → diff

Your agent writes src/port.rs; diff replays every recorded case and shows where the first difference is.

bench → shadow

Time both sides including the bridge, and run them side by side before switching anything on.

gate → enable

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.

CheckWhat it means
Code qualitycargo fmt, clippy with -D warnings, tests and an unsafe-code audit
Error pathsA recorded failing case for every error path of the original; no unwrap/expect/panic where the original returns an error
Recording integrityNot stale (original unchanged since record) and not altered (no cases edited or removed)
Cheat guardRefuses answer tables, deleted failing tests and edited cases
SizeNo more than 3x the original's lines plus 50

Language Support

LanguageStatus and runtime
TypeScript / JavaScriptVerified on json-server, Fuse.js, vercel/ms and x18n; Node 22.6+
PythonSupported; Python 3.9+
C, Go, Ruby, JavaSupported; C compiler, Go 1.21+, Ruby 3+, JDK 17+
PHP, C#, Kotlin, PowerShellPreview
Quick Start

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.

More Commands:
Or with Cargo:
cargo install rust-anything
Record the original:
rust-anything record <crate>
Replay against the port:
rust-anything diff <crate>
Decide if it is done:
rust-anything gate <crate>
Switch the port on / off:
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.

HONEST NOTES

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.
🤖 Agents

MCP tools for every step plus a workflow skill for Claude Code, Codex, Cursor, Gemini CLI and OpenCode.

📘 Docs

rustanything.ai, including real-world case studies with the slow results next to the fast ones.

⚖️ License

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+.