erkamyaman/rust-anything
GRADUAL MIGRATION TOOL TO RUST
Tool for stepwise rewriting applications to Rust with behavior verification on recorded tests. Supports TypeScript, Python, C, Go, Ruby, Java — CLI, HTTP servers and libraries.
// KEY FEATURES
- Records original behavior on generated and user-provided inputs
- Generates Rust crate and wrapper preserving original API
- Verifies port against all recorded cases until byte-for-byte match
- Prettier in Rust: 19× faster, json-server: 21× less memory
// DEEP DIVE: HOW IT WORKS
rust-anything works in four stages: record runs the original code on many inputs (generated edge cases, semantic traps, and user data) and saves results; bridge creates a Rust crate and FFI wrapper so callers keep the same API; diff replays the same cases through the Rust implementation and requires byte-for-byte match; lift converts the project to pure Rust when all checks pass without fallback. The original code is never modified.
Unlike classic transpilers, rust-anything does not auto-convert code — it lets an agent or human write Rust manually, then strictly validates the result against real behavior. Inside: property-based test generation, FFI bridges for each language (Node.js/TypeScript, Python, C, Go, Ruby, Java), performance measurement at each step. Already used to port Prettier (19× speedup), json-server (memory 74→3.5 MB), and Fuse.js (32× faster).
Limitations: record and app record execute the original code many times — code that writes files, DB, or network will do so per case. README warns to run on a project copy, with a test DB and no production credentials. Requires Rust toolchain and cargo install rust-anything.
// USE CASES
Best for: Developers migrating performance-critical parts to Rust without risk of breaking logic
- Stepwise rewrite a CLI utility hot path to Rust, verifying each step on real data
- Migrate a Node.js HTTP server to a single Rust binary preserving API and cutting memory 20×
- Accelerate a compute-heavy library (search, parsing, formatting) up to 30× without changing interface
// QUICK START
cargo install rust-anything
rust-anything setupCommands are taken from the repository README — check the current version on GitHub before running.
New repositories every 30 minutes
REDDYX AI scans GitHub 24/7 and ships the best AI/ML/Web3 projects to Telegram.
Join on Telegram