Hello, World!
fn main() {
println!("Hello, World!");
}Tap Run to execute
main.rs · output appears here
Press Run to execute
Output streams here as your program runs.
Rust is a statically typed systems programming language that originated as a Mozilla project led by Graydon Hoare, reaching its stable 1.0 release in 2015. Its defining feature is the ownership and borrowing model, which guarantees memory safety and data-race freedom at compile time without a garbage collector. Rust is multi-paradigm, blending imperative, functional, and zero-cost abstractions.
Today Rust is popular for performance-critical and safety-sensitive software, including operating system components, web assembly, networking, and command-line tools, and has been adopted in the Linux kernel. Its package manager Cargo and the crates.io registry make dependency management straightforward. This compiler runs Rust 1.68.2, so you can use the ownership system, traits, pattern matching, and the standard library in your programs.
main.rs is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
main.rs declares the sibling helper.rs module with mod.
mod helper;
fn main() {
println!("{}", helper::answer());
}
pub fn answer() -> i32 {
42
}
fn main() {
println!("Hello, World!");
}use std::io;
fn main() {
let mut name = String::new();
io::stdin().read_line(&mut name).unwrap();
println!("Hello, {}!", name.trim());
}fn main() {
let fruits = vec!["apple", "banana", "cherry"];
for (i, fruit) in fruits.iter().enumerate() {
println!("{} {}", i + 1, fruit);
}
}fn factorial(n: u64) -> u64 {
if n <= 1 { 1 } else { n * factorial(n - 1) }
}
fn main() {
println!("{}", factorial(5));
}fn parse(s: &str) -> Result<i32, std::num::ParseIntError> {
s.parse::<i32>()
}
fn main() {
match parse("abc") {
Ok(n) => println!("Got {}", n),
Err(e) => println!("Error: {}", e),
}
}use std::collections::HashMap;
fn main() {
let mut counts: HashMap<char, i32> = HashMap::new();
for c in "banana".chars() {
*counts.entry(c).or_insert(0) += 1;
}
for (ch, n) in &counts {
println!("{}: {}", ch, n);
}
}fn main() {
let mut nums = vec![3, 1, 4, 1, 5];
nums.sort();
let doubled: Vec<i32> = nums.iter().map(|x| x * 2).collect();
println!("{:?}", doubled);
}struct Person {
name: String,
age: u32,
}
impl Person {
fn describe(&self) -> String {
format!("{} ({})", self.name, self.age)
}
}
fn main() {
let p = Person { name: String::from("Ada"), age: 36 };
println!("{}", p.describe());
}enum Shape {
Circle(f64),
Square(f64),
}
fn area(s: &Shape) -> f64 {
match s {
Shape::Circle(r) => 3.14159 * r * r,
Shape::Square(side) => side * side,
}
}
fn main() {
println!("{}", area(&Shape::Square(3.0)));
}trait Greet {
fn hello(&self) -> String;
}
struct Dog;
impl Greet for Dog {
fn hello(&self) -> String {
String::from("Woof")
}
}
fn main() {
let d = Dog;
println!("{}", d.hello());
}The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
Rust is one of 23 linked-project compilers. Run always starts main.rs; selecting a helper tab changes what you edit, not the entry file.
main.rs declares the sibling helper.rs module with mod.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every Rust tab and a README in one ZIP archive.