Rust is a general-purpose systems language stewarded by the Rust Foundation. It powers infrastructure tools (ripgrep, fd), cloud edge services, game engines, and WebAssembly modules.
Core characteristics
- Ownership model — each value has one owner; moves and borrows are checked at compile time
- No GC in safe code — destructors run when values go out of scope
- Zero-cost abstractions — iterators and generics compile to efficient machine code
- Algebraic enums —
Option,Result, and custom enums with data
Typical build-run flow (local)
- Write
main.rswithfn main() rustc main.rsorcargo runin a project- Run the native binary—no JVM required
Important interview questions and answers
- Q: Is Rust garbage collected?
A: No—ownership determines when memory is freed; optional patterns likeArcexist for shared ownership. - Q: Why is Rust hard for beginners?
A: The borrow checker enforces rules other languages hide with GC or manual discipline. - Q: Rust vs C++?
A: Both compile natively; Rust's safe subset prevents many C++ memory bugs at compile time.
Self-check
- What file extension do Rust source files use?
- Name one real-world tool written in Rust.
Interview prep
- Is Rust garbage collected?
No—values are dropped when their owner goes out of scope. Shared ownership uses patterns like
RcorArcwhen needed.