TL;DR: rust-anything sits alongside your existing codebase in TypeScript, JavaScript, Python, C, Go, Ruby, or Java to facilitate a gradual migration to Rust. It operates by capturing inputs, return values, and thrown errors from the original implementation during automated test runs.
Best for: Developers migrating performance-critical legacy code or whole apps to Rust without breaking existing behavior.
Repository snapshot: ⭐ 5 212 stars · 🍴 417 forks · Rust · MIT
Daily picks: Follow GitHub Open Source on Telegram

What it is

rust-anything is an open-source development tool designed to facilitate the gradual migration of legacy codebases written in languages like TypeScript, JavaScript, Python, C, Go, Ruby, or Java into pure Rust. Instead of a risky, all-at-once rewrite, it enables developers to port applications component by component while guaranteeing identical behavior.

How it works

The tool operates by capturing inputs, return values, and thrown errors from your original implementation during automated test runs. This creates a rigorous behavioral baseline. Developers or AI coding agents then write the Rust equivalent. Using differential replaying, thousands of recorded test cases are executed against the new Rust port to verify identical outputs before lifting the component into a standalone binary.

Key features

  • Record original application behavior on edge cases to establish a reliable baseline
  • Bridge generated Rust crates with wrappers so callers retain the original API structure
  • Replay thousands of recorded test cases against the Rust port to verify identical outputs
  • Profile codebases to identify hot paths and loops worth moving out of interpreted runtimes
  • Lift fully verified components and dependencies into a standalone pure Rust application

Getting started

Clone the repository from GitHub to begin your migration journey. Ensure you have Rust and your source language's runtime installed. Follow the documentation in the repository to start capturing test baselines for your specific project.

When not to use it

Do not use this tool if you are looking for an automated code translator; you still have to write the Rust code yourself. It is also unnecessary for greenfield projects or very small scripts where a total rewrite from scratch is faster and simpler.

Discuss

Which hot path in your current stack would you rewrite in Rust first?

Curated from the repository README and metadata. No hands-on test is claimed; evaluate it in a sandbox before production use.