Skip to content

Rewrite your app in Rust.Prove it behaves the same.

rust-anything records what your code does, then replays every recorded case against the Rust port. Your agent writes the Rust. Nothing ships until the outputs match.

src/words.ts
export function wordCount(text: string): number {  return text.split(/\s+/).filter(Boolean).length}
src/port.rsbridge: napi-rs
pub fn word_count(text: &str) -> usize {    text.split_whitespace().count()}
Verified TypeScript port, Fuse.js: 3,414 / 3,414 recorded cases match
32x
Fuse.js search per query on 50,000 strings, Apple M4
3.5MB
json-server idle memory after the lift, from 74 MB in Node
514/514
json-server HTTP cases matching on a pure Rust binary
10
languages: eight with verified ports, Kotlin and PowerShell tested end to end
rust-anything on Trendshift (daily)rust-anything on Trendshift (daily?language=Rust)rust-anything on Trendshift (weekly)rust-anything on Trendshift (weekly?language=Rust)

Prettier, ported to Rust

Prettier and its Rust port format the same 59 real files, one process per file: Prettier takes 3.63 s, the Rust port 0.20 s, with the same output byte for byte.

Prettier and its Rust port format the same 59 files; the Rust port is 19x faster with identical output.

Install

Install the CLI, then register the MCP server and the workflow skill with Claude Code, Codex, Cursor and Gemini CLI.

$cargo install rust-anything
$rust-anything setup

Prebuilt binaries for macOS, Linux and Windows are on each GitHub release.

How a port gets done

The original stays the source of truth. rust-anything does not translate code: it supplies what an agent cannot guess, and a gate that says when a port is done.

  1. Record

    record

    record runs the original on generated edge cases, semantic traps and your own inputs, and saves what it returns or throws.

  2. Port

    bridge

    bridge generates the Rust crate and a wrapper, so callers keep the original API. You or your agent write the Rust.

  3. Check

    diff, gate

    diff replays every recorded case against the Rust, and nothing ships until they all match and gate passes.

  4. Lift

    app lift

    When replay passes with no fallback and every unit passes gate, app lift makes it a pure Rust app. The original is never touched.

What the recording catches

A first port of x18n's fuzzyScore indexed by Rust char. It passed simple tests, and failed diff.

~/x18n
# where the time goes, and who calls it
$ rust-anything profile . -- node bench.mjs
$ rust-anything bridge . src/fuzzy.ts --batch fuzzyScore:text
# write src/port.rs (or let your agent), then:
$ rust-anything record rust/fuzzy-rs
$ rust-anything build rust/fuzzy-rs
$ rust-anything diff rust/fuzzy-rs
$ rust-anything bench rust/fuzzy-rs
$ rust-anything gate rust/fuzzy-rs
# diff, first port
198/200 cases match
- fuzzyScore("b😀", "a😀b😀c"): expected {"ok":1997}, got {"ok":1998}

# JS indexOf counts UTF-16 code units,
# so an emoji is two positions.

# with the generated utf16 helpers:
# 2000/2000 cases, and the gate passes

Measured on real projects

Every number has a benchmark that first checks the results are identical. The slow cases are listed too: calling Rust once per small function is usually slower than a JIT.

json-server benchmark · requests per second, run 1 / run 2 · Apple M4, Node 24.15.0
Request (fixture database)Node, 1 conn.Rust, 1 conn.Node, 50 conn.Rust, 50 conn.
GET /posts11.1k / 10.8k27.3k / 23.9k19.7k / 20.4k115.0k / 110.7k
GET /posts/111.0k / 11.3k27.7k / 25.4k21.9k / 22.6k119.9k / 99.0k
?_embed=comments8.7k / 6.6k22.5k / 21.8k13.8k / 11.0k98.3k / 100.6k
POST /comments, 10 connections2,973 / 2,4675,821 / 5,976

Where the gap is small: one connection reading the whole 10,000-post list (1.2x), and writes on the big database (1.1 to 1.2x), since both rewrite the whole file on every write. Full tables

Sponsors

rust-anything is free and open source. If it helps your work, please consider sponsoring it. Your support keeps development going.