Rewriting apps in Rust, one verified step at a time

A split mechanical puzzle: one side decaying, made of old circuit boards and brittle wires; the other side polished metal and glowing fibres, reassembling piece by piece, light spreading across the di

A developer tool called rust-anything is enabling teams to rewrite applications in Rust incrementally, while guaranteeing that each step behaves exactly like the original. Created by erKam Yaman, it supports TypeScript, Python, C, Go, Ruby, and Java, with PHP and C# in preview. The approach is not automatic translation — instead, it records real behaviour from existing code and uses it as a test oracle during the Rust rewrite, ensuring correctness at every stage.

This method addresses a major pain point in systems programming: the high cost and risk of rewriting large, complex applications. Rust promises performance, safety, and maintainability, but full rewrites are often impractical. rust-anything lowers the barrier by allowing teams to port one function or module at a time, with verification at each step.

How rust-anything works

The tool follows an eight-step workflow: profile → analyze → bridge → record → port → diff → bench → gate. First, it profiles the original application to identify hot paths — functions consuming the most time. Then it analyzes the codebase to determine what to port first, considering dependencies and risks like edge-case handling.

Next, it builds a bridge — a Rust crate with bindings that match the original API, using tools like napi-rs for Node.js or PyO3 for Python. It records the original’s behaviour by running it on diverse inputs, including edge cases like NaN, negative zero, and non-ASCII strings. These inputs are saved and later replayed against the Rust implementation.

After the Rust code is written — by a human or AI coding agent — the tool checks for exact output matches (diff), benchmarks performance (bench), and finally gates the change with linting, safety checks, and fallback logic until confidence is high.

Performance gains and practical use

Reported benchmarks show significant speedups. For example, a TypeScript fuzzy search handling 50,000 keys dropped from 10 ms to 0.5 ms — a 20x improvement. Python’s slugify over 20,000 strings became 17x faster. Even Go and Java, already performant, saw 4x and 3x gains respectively.

These wins come from moving hot loops into Rust while keeping the original interface. The tool identifies where Rust adds value — typically in CPU-bound tasks — and avoids overhead from frequent cross-language calls by batching operations. For instance, passing thousands of strings at once to a Rust function reduces FFI overhead and leverages parallelism.

The system is designed for integration with AI coding agents like Claude Code, Codex, and Cursor. Running rust-anything setup configures these agents with a skill and an MCP server, enabling natural language commands such as “Rewrite this CLI in Rust” or “Profile and port the slowest function.”

Applicability across regions and industries

In the UK, where fintech and cloud services dominate, gradual migration tools reduce risk in regulated environments. For UAE’s government-driven digital transformation, rust-anything offers a path to high-performance systems without disrupting live services. In the US, tech scale-ups can leverage it to optimise legacy Python or JavaScript backends. In Kazakhstan, where software modernisation is accelerating, it supports sovereignty by reducing reliance on proprietary runtimes.

The tool’s independence from the Rust Foundation and lack of affiliation with major vendors means it avoids vendor lock-in — a key benefit for organisations prioritising control. However, reliance on AI agents may introduce new dependencies, particularly if teams adopt closed-source coding tools.

What it means

rust-anything shifts the paradigm from risky big-bang rewrites to safe, iterative modernisation. It makes Rust adoption accessible not just to greenfield projects, but to any team maintaining performance-critical applications in dynamic languages.

For founders and engineers, this means lower technical debt, better runtime efficiency, and stronger data control — all without sacrificing stability. It also raises the bar for correctness: with 38,251 recorded cases replayed and zero mismatches reported, the tool enforces a level of behavioural fidelity rarely achieved in manual rewrites.

Organisations should assess hot paths in their current stack — especially in Node.js, Python, or Ruby — and consider piloting rust-anything in non-critical modules. The process requires no immediate toolchain switch; prebuilt binaries are available for macOS, Linux, and Windows.

The project’s preview status for PHP and C# suggests caution in those ecosystems, but core language support appears robust. As with any migration tool, coverage depends on the original test suite and workload diversity — if edge cases aren’t exercised, they won’t be recorded.

The future of systems modernisation may not be a full rewrite, but a series of small, verified steps — each one safer, faster, and more deliberate than the last.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *