Skip to content
Novus Examples
rs84 B

Rust — Hello World

The classic hello-world in Rust — fn main and the println! macro — for testing highlighters, rustc, and parsers.

Preview — first 5 linesrs
// The classic first program, in Rust.
fn main() {
    println!("Hello, world!");
}

Specifications

Language
Rust
Kind
hello-world
Lines
4
Encoding
UTF-8
Line Endings
LF

What is a .rs file?

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 this 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.

Generated by generation/code_samples.py. Free for any use, no attribution required — license.