DEV Community

Antonio Ventura
Antonio Ventura

Posted on Edited on

Rust Anything: Port to Rust and Verify Behavior


title: "Rust Anything: Port your code to Rust and check that it still behaves the same"
published: false
description: "An open-source tool that records how your code behaves and replays those cases against a Rust port."

tags: rust, opensource, tooling, ai

When you port a piece of software to Rust, getting it to compile is just the beginning. The harder question comes next: Does it still behave like the original?

I came across Rust Anything, an open-source project by Erkam Yaman that helps you answer that question by migrating one component at a time and using the original implementation as a baseline.

How it works

  1. Rust Anything runs the original code and records inputs and outputs.
  2. A coding agent writes the Rust implementation.
  3. Rust Anything replays the recorded cases against the port and flags any differences.

The project reports matching results for all 3,414 recorded cases in its Fuse.js port. It also documents a port of PEAR XML_Util, a PHP library that calls into Rust through PHP’s ext-ffi extension.

Where I’d start

In a PHP or TypeScript backend, I’d start with a component whose inputs and outputs are easy to reproduce, such as a parser or file transformer. I’d include malformed inputs and edge cases in the comparison, then benchmark both implementations with a representative workload to see whether the port is worth keeping.

If you already have Cargo, you can install the tool and set up integrations with coding agents such as Codex, Claude Code, or OpenCode:

cargo install rust-anything
rust-anything setup
Enter fullscreen mode Exit fullscreen mode

What part of an application you maintain would you try porting to Rust first?

Top comments (0)