Top 1,000 Features Creators Resources Extensions Blog Explorer CSV Download
GitHub icon


< >

Rust is an open source programming language created in 2010 by Graydon Hoare.

#21on PLDB 14Years Old 357kRepos
Download source code:
git clone

Try now: Riju ยท TIO ยท Replit

Rust is a systems programming language sponsored by Mozilla Research, which describes it as a "safe, concurrent, practical language," supporting functional and imperative-procedural paradigms. Rust is syntactically similar to C++, but its designers intend it to provide better memory safety while maintaining performance. Rust is an open source programming language. Read more on Wikipedia...

Example from Compiler Explorer:
// Type your code here, or load an example. pub fn square(num: i32) -> i32 { num * num } // If you use `main()`, declare it as `pub` to see it in the output: // pub fn main() { ... }
Example from Riju:
fn main() { println!("Hello, world!"); }
Example from hello-world:
fn main() { println!("Hello World"); }
// Hello world in Rust fn main() { println!("Hello World!"); }
Example from Linguist:
extern crate foo; extern crate bar; use foo::{self, quix}; use bar::car::*; use bar; fn main() { println!("Hello {}", "World"); panic!("Goodbye") }
abstract alignof as become box break const continue crate do else enum extern false final fn for if impl in let loop macro match mod move mut offsetof override priv proc pub pure ref return Self self sizeof static struct super trait true type typeof unsafe unsized use virtual where while yield

Language features

Feature Supported Token Example
Conditionals โœ“
Constants โœ“
While Loops โœ“
Booleans โœ“ true false
Line Comments โœ“ //
// A comment
Type Inference โœ“
Print() Debugging โœ“ println!
Pattern Matching โœ“
Operator Overloading โœ“
Macros โœ“
macro_rules! vec {
    ( $( $x:expr ),* ) => {
            let mut temp_vec = Vec::new();
Iterators โœ“
for n in 0..42 {
  println!("{}", n);
File Imports โœ“
use ::std::fs;  // Imports from the `std` crate, not the module below.
use self::std::fs as self_fs;  // Imports the module below.
mod my;
use self::foo::Zoo as _;
#[path = ""]
mod c;
Directives โœ“
// A conditionally-compiled module
#[cfg(target_os = "linux")]
mod bar {
    /* ... */
// General metadata applied to the enclosing module or crate.
#![crate_type = "lib"]
// A function marked as a unit test
fn test_foo() {
    /* ... */
// A lint attribute used to suppress a warning/error
type int8_t = i8;

// Inner attribute applies to the entire function.
fn some_unused_variables() {

  let x = ();
  let y = ();
  let z = ();
MultiLine Comments โœ“ /* */
/* A comment
Comments โœ“
// a comment
Strings โœ“ "
"hello world"
Case Insensitive Identifiers X
Semantic Indentation X

View source

- Build the next great programming language ยท About ยท Acknowledgements ยท Published by Breck's Lab