rs
What is a .rs file?
text/rust
Rust (.rs) is a plain-text source file for the Rust programming language — a statically typed, compiled systems language focused on memory safety without a garbage collector, enforced by its ownership and borrow checker. It features enums with data, pattern matching, traits, generics, and a strong type system.
How to use a .rs file
Use an example .rs file to test syntax highlighters, the rustc compiler and cargo, rustfmt and clippy, and parser or language-detection tooling against real Rust constructs.
Download example .rs files
- Rust — Hello WorldThe classic hello-world in Rust — fn main and the println! macro — for testing highlighters, rustc, and parsers.
- Rust — Shapes (enum, trait, pattern matching)A realistic Rust snippet with an enum carrying data, a trait and impl, exhaustive match, iterators, and Option handling — for testing highlighters, rustc, clippy, and parsers against real ownership-era code.