Rust Crash Course: Learn Enough to Get Over the Hump
Learn enough Rust to get past the hardest part of the learning curve
Rust is a systems programming language that eliminates entire classes of bugs and security vulnerabilities, has zero-cost abstractions like C and C++, is fun to program in, and lets systems programmers have nice things. No wonder Rust is gaining traction in spaces as diverse as game engines, high-performance computing, embedded devices, and web programming.
Join expert Nathan Stocks to learn why Rust is so different from other programming languages and discover how it can benefit you. Through hands-on exercises, you'll explore what makes Rust such a compelling language, such as safety, concurrency, speed, ownership model, and zero-cost abstractions, and examine Rust’s packaging ecosystem, from libraries, binaries, modules, and dependencies to publishing and documenting. Along the way, you'll create, compile, and run a Rust project, navigate library documentation, and find answers to common questions.
Learn how to write high-performance code without the worry of crashes or security vulnerabilities, and join a vibrant community of developers where diversity, inclusion, and just plain being nice are all first-class objectives.
What you'll learn-and how you can apply it
By the end of this live online course, you’ll understand:
- What makes Rust such a compelling language
- Rust’s packaging ecosystem
- Introductory Rust concepts, such as variables, control flow, lifetimes, types, and compiling
- Intermediate Rust concepts, like pattern matching, testing, functions, and strings
- Advanced Rust concepts, including multithreading, traits, and structs
And you’ll be able to:
- Create, compile, and run a Rust project
- Understand the language and navigate library documentation
- Get help and find answers to common questions
- Find and integrate other Rust projects into your own
- Identify the benefits of Rust by creating Rust versions of your own projects and comparing the development experience and resulting performance
This training course is for you because...
- You're a C or C++ programmer who wants power and zero-cost abstractions without security vulnerabilities, undefined behavior, crashes, and other rough edges.
- You need more performance out of your language than Python or Ruby can provide.
- You're already experienced in other languages, and you want to get up and running with Rust in record time.
- You want to be a systems programmer.
- You need to deal directly with hardware—for example, you need your code to run on a microcontroller, or you want to write a device driver.
- A basic understanding of general programming concepts, such as variables, types, loops, and functions
- Familiarity with computer hardware and architecture terminology (stack, heap, bits, bytes, etc.)
- Experience in at least one programming language
- A machine (macOS, Linux, or Windows) with the latest version of stable Rust installed
- Install Rust.
- Choose an IDE (or editor), configure it with Rust support, and customize it to your liking.
- Choose one place to "find answers" and either introduce yourself (if it's a forum, IRC, etc.) or find the answer to one question you have.
- Try doing something in Rust, such as cargo new message, cd message, cargo run, or edit src/main.rs and change the message and cargo run again to see your new message.
- Check out the descriptions of the tools and books sections of How to Learn Rust to learn more.
- Read Programming Rust (book)
About your instructor
Nathan Stocks is an engineering manager of Git Infrastructure at GitHub by day and a hopelessly naive indie game developer by night. He has been working with scalable infrastructure and services for over 15 years. He likes growing maple trees from seed, playing frisbee, spending time with his wife and kids, and eating food.
The timeframes are only estimates and may vary according to how the class is progressing
Overview (10 minutes)
- Lecture: Where did Rust come from?; What makes Rust so different, and why would you want to use it?; ownership—the key to a different mindset
- Group discussion: What kind of language are you most experienced with?
Getting started (15 minutes)
- Lecture: Cargo; variables
- Hands-on exercise: Create and run your own project; use cargo to create a binary project; alter and run the project to observe the effects
Functions (25 minutes)
- Lecture: Scope; memory safety; functions
- Hands-on exercise: Add functions to the example project; run the project to ensure your functions work correctly
- Break (5 minutes)
Simple types (25 minutes)
- Lecture: Scalar types; compound types
- Hands-on exercise: Write code to transform data from an example project through several stages
Interaction (25 minutes)
- Lecture: Control flow; strings
- Hands-on exercise: Write code to alter the behavior of the example project with various command-line options
- Break (5 minutes)
Data (25 minutes)
- Lecture: Ownership; references; borrowing
- Hands-on exercise: Using the example project, add functions that inspect or modify data without taking ownership of the data; use references to borrow the data and call into the above functions
Power tools: Part 1 (25 minutes)
- Lecture: Structs; traits
- Hands-on exercise: Create your own trait that can accomplish the supplied task; create two different structs; implement your trait for both of your structs; write a function that can take any struct implementing your trait
- Break (5 minutes)
Power tools: Part 2 (25 minutes)
- Lecture: Collections; enums
- Hands-on exercise: Create an enum that represents different reporting categories; write a data-processing pipeline that accepts the incoming data and uses your enum to store statistics in an appropriate collection; output your statistics at the end
Bringing it all together (35 minutes)
- Hands-on exercise: Use your knowledge to create an image processing application; if you have time after you have a working project, go back and complete additional options to add features to your application
- Group discussion: Were you able to complete one option from each section and get your project working?