Bitterless Rust

Introduction

About This Tutorial

Welcome to "Bitterless Rust."

Rust tutorials have way too many explanations that beginners don't need. Ownership, lifetimes, the borrow checker, zero-cost abstractions... Sure, these are important Rust concepts, but you don't need to understand all of them from the start.

This tutorial ruthlessly cuts out all those "bitter" parts.

Important note: The explanations in this tutorial are quite imprecise. This is intentional. We prioritize "just being able to write code" over accuracy. After learning here, we strongly recommend supplementing your knowledge with the official documentation or The Rust Programming Language (a.k.a. The Book).

The Rules of This Tutorial

  1. If the compiler yells at you, .clone() it — don't ask why
  2. Avoid references (&) as much as possible — the only exception is &self in methods
  3. Only memorize 3 numeric typesi32, usize, f64
  4. If it works, it's correct

What You'll Learn

  • How to use Cargo (Rust's build tool)
  • Variables, types, functions, control flow
  • Structs and enums
  • Vec and String (the dynamic ones)
  • Option and Result (error handling)
  • Hands-on: Building a four-operation calculator (Lexer -> Parser -> Eval)

What You Won't Learn

  • How ownership actually works
  • Lifetimes
  • Borrow checker details
  • Traits (we'll touch on them just a little)
  • Async/await
  • Macros
  • unsafe

Prerequisites

This tutorial is aimed at people who have some experience with any programming language. We assume you already know basic programming concepts like variables, functions, if statements, and loops.

Setting Up

Install rustup. Run this in your terminal:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Once installed, verify:

rustc --version
cargo --version

If you see version numbers, you're good. Let's move on.

Related

Back to book