Released · improving
Programming language · Since 2015
Rust is a systems programming language that guarantees memory safety without a garbage collector, combining C/C++-level performance with safe concurrency.
Rust is a general-purpose programming language built for both performance and reliability. Version 1.0 was released in 2015, and the language is developed in the open by the Rust Project with support from the Rust Foundation. Its compiler enforces ownership and borrowing rules, which rules out whole classes of bugs, such as use-after-free and data races, at compile time and without a garbage collector.
Rust shines where speed and correctness both matter: operating system components, command-line tools, network services, embedded devices and WebAssembly. Its minimal runtime and direct C interoperability also make it a practical choice for gradually replacing parts of existing C or C++ codebases. With Cargo as the standard build tool and crates.io as the package registry, dependencies, builds and tests all work the same way across projects.
To get started, install the toolchain with rustup and work through the official book, "The Rust Programming Language", running each example yourself. Ownership can feel unfamiliar at first, but the compiler's error messages are detailed and often suggest the fix, which makes learning by doing effective. TASTEDEV offers TASTECODE, a free Rust development environment.
The compiler checks ownership, borrowing and lifetimes, preventing use-after-free and null pointer errors with no runtime overhead.
The type system tracks how data is shared between threads, so code with data races simply does not compile.
Generics, traits and iterators compile down to machine code that performs on par with hand-written low-level code.
Cargo handles project setup, dependencies, builds, tests and documentation, while rustfmt and Clippy keep code consistent and clean.
Install rustup, the official Rust installer. On macOS and Linux, run the command below; on Windows, download and run rustup-init.exe from rust-lang.org. Windows may also require the Visual Studio C++ build tools, and the installer will guide you through it.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shOpen a new terminal and check that the rustc compiler and the Cargo build tool print their versions. Run rustup update later to move to the latest stable release.
rustc --version && cargo --versionUse Cargo to create a new project, then build and run it. The project folder contains a Cargo.toml manifest and a src/main.rs source file.
cargo new hello && cd hello && cargo runEvery Rust executable starts at the main function. println! is a macro (note the exclamation mark) that writes a line of text to standard output. A project created with cargo new already contains this code in src/main.rs, and cargo run compiles and runs it in one step.
src/main.rs
fn main() {
println!("Hello, world!");
}
cargo runSix chapters that take you from installation to the core ideas of Rust.
Ask questions, share experience and trade opinions about Rust.
No discussions yet. Start the first one.
0 comments
Sign in · Sign in to leave a comment.
Be the first to comment.