Alright Monday morning, cold and the new excitement of a fresh week. I will be sharing my weekly learnings on Rust. Embarking on a 4-week learning experience, to move into Rust. If you must follow this, there is bound to be mistakes, this is a newbie sharing their understanding. One of the key things of learning is that you should be able to easily teach. Welcome to Monday Rust, where we make learning Rust as smooth and fun as your first cup of coffee on a Monday morning. Let’s dive in!
Rust uses rustup
, a toolchain installer and manager, to simplify the installation process. I will be using a wsl setup to build this on, mention this in a previous article. Follow these simple steps to get Rust up and running on your system:
Run the following command in your terminal:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
This command downloads and installs rustup
, setting up Rust on your machine.
Once installed, verify that Rust is properly set up by running:
rustc --version
This will display the installed Rust version, confirming that your environment is ready.
Rust comes with cargo
, its powerful build system and package manager. You’ll use cargo
to create and manage your Rust projects.
To create a new project, follow these steps:
Run:
cargo new hello_world
This command creates a new folder named hello_world
with all the necessary files.
Navigate into your project folder:
cd hello_world
To build and run your project:
cargo run
You’ll see the classic "Hello, world!" output, marking your first Rust program!
Before diving into local development, you can experiment with Rust online using these tools:
Rust Playground: This is an online environment where you can write, edit, and run Rust code right in your browser. It’s perfect for quick experiments and sharing code snippets.
Rust Practice Course: This interactive course guides you through Rust’s features with hands-on exercises. It’s a fantastic way to deepen your understanding and build confidence.
Rust is designed for performance, reliability, and productivity. With its emphasis on memory safety and zero-cost abstractions, it’s the go-to language for developers looking to build high-performance applications without sacrificing safety.
You’re all set to start your Rust adventure! Dive into the tutorials on Rust Practice Course and play around with Rust Playground for a hands-on experience. Rust’s learning curve might seem steep at first, but with consistent practice, you’ll be writing elegant, efficient code in no time.
I will be haring my weekly learning through Monday Rust, the aim here is to learn and teach. Happy coding and Glorious Week Ahead!
Fabian Owuor