C C++ C# R SQL MDB PHP TS Rust
⭐ Pro Course
LabsICT ← Compilers
main.rs
Output
Click Run to execute your code.

Online Rust Compiler

Write and run Rust code directly in your browser with this free online compiler. Rust is a systems programming language focused on safety, speed, and concurrency. It guarantees memory safety without garbage collection and prevents data races at compile time. This compiler lets you execute Rust code instantly without installing rustup or cargo.

What is Rust?

Rust is a multi-paradigm, compiled programming language created by Graydon Hoare at Mozilla Research in 2010, with its first stable release in 2015. Rust is designed for performance, type safety, and thread safety. Its ownership system ensures memory safety without a garbage collector, making it ideal for systems programming, embedded devices, and performance-critical applications. Rust has been voted the "most loved programming language" in Stack Overflow surveys for multiple consecutive years.

Key Features

Basic Rust Syntax

// Struct definition
struct Developer {
    name: String,
}

impl Developer {
    fn greet(&self) {
        println!("Welcome, {}!", self.name);
    }
}

fn main() {
    // Variables
    let site = "LabsICT";
    let _year = 2025;

    // Vector and loop
    let languages = vec!["Rust", "Python", "Java"];
    for lang in &languages {
        println!("Learn {} at {}", lang, site);
    }

    // Struct usage
    let dev = Developer { name: String::from("Bilal") };
    dev.greet();

    // Pattern matching
    let language = "Rust";
    match language {
        "Rust" => println!("Systems programming!"),
        "Python" => println!("Data science!"),
        _ => println!("Something else!"),
    }
}

What Can You Build with Rust?

Rust is used for systems programming, operating systems (Redox), game engines, and web browsers (Servo). Companies like Mozilla, Google, Microsoft, and Amazon use Rust for performance-critical services. It is increasingly popular for CLI tools, web servers, databases, and embedded systems. Rust is also used for blockchain development, game development with Bevy, and WebAssembly applications that run in the browser.

Try It Yourself

Type your Rust code in the editor and click Run. The compiler supports standard Rust features including structs, enums, traits, pattern matching, and the ownership system. Use Copy to save, Reset to restore the example, and Share to generate a link.

Related Resources

Continue with our Rust learning track, try more online compilers, or browse tutorials for step-by-step guides.