After seven years writing PHP, picking up Rust felt like being a senior developer again for exactly one week — right up until the borrow checker introduced itself. What followed was humbling, occasionally infuriating, and ultimately the most useful thing I have done for my engineering in years.
The mental model shift
PHP lets you pass anything anywhere and sorts out the consequences at runtime. Rust asks you to prove, at compile time, who owns every value and who may still read it. The first month felt like bureaucracy. Then the pattern emerged: nearly every bug the compiler rejected was one I would eventually have found in production anyway — just later, at 3am, with more witnesses.
<pre><code class="language-rust">fn main() {
let jobs = vec!["resize", "thumbnail", "compress"];
// Moves the vec — jobs can no longer be used after this line.
let pending = jobs;
// error[E0382]: borrow of moved value: `jobs`
println!("{} jobs", jobs.len());
}</code></pre>
What transfers directly from PHP
More than I expected. Architecture instincts — small functions, explicit types, pushing effects to the edges — map cleanly. Testing discipline maps perfectly: cargo test is Pest with faster feedback. Even composer habits transfer to cargo, though cargo's resolver will never surprise you the way composer occasionally can.
- Trait objects ≈ interfaces, but resolved at compile time unless dyn
- Result<T, E> ≈ exceptions you cannot forget to handle
- rayon ≈ parallel foreach that actually uses every core
- serde ≈ hydration and casting with zero runtime cost
Where the speed comes from
My batch worker was twenty times faster than its PHP predecessor — but not because Rust executes loops twenty times faster. The wins came from architecture: no per-job bootstrapping, no framework lifecycle, threads instead of processes, and the ability to keep Postgres connections hot across thousands of jobs. The language enabled the design; the design delivered the speed.
PHP taught me to optimise the developer. Rust taught me what we pay when the developer always wins.
Practical advice
Don't learn Rust from tutorials — pick a small, real tool you would otherwise write in PHP and port it. Mine was a queue worker. Clippy and rust-analyzer are non-negotiable; they teach idioms faster than any book. And read the async book before touching Tokio, not after your futures refuse to compile.
I still reach for PHP/Laravel for web products and expect to for years. But for CLI tools, parsers and performance-critical services, Rust has earned a permanent place in the stack — and the discipline it enforces has measurably improved how I write everything else.