We may earn an affiliate commission when you visit our partners.
Course image
Packt Publishing

The Rust programming language makes it possible to build fast reliable code, prevents segfaults, and guarantees memory safety, even while working across concurrent processes.

Read more

The Rust programming language makes it possible to build fast reliable code, prevents segfaults, and guarantees memory safety, even while working across concurrent processes.

The course is split into seven parts, which give you a complete overview of why Rust is a great programming language. In the first couple of days, you’ll learn to install Rust on your system, discover its syntax, and see a library that utilizes the feature of trait-based generics and code reusability.

On days 3 and 4, you’ll understand how Rust Lifetimes work by doing extensive compiler checking and learn to make your programs more interactive by accessing all the bits of the Rust environment. On day 5, you’ll learn about multithreading without data races with safe concurrency. Day 6, you’ll create a database, using your code to read and update while securing it with Bcrypt from various breaches such as SQL injection attacks.

By the end of the course, you’ll have built a mini-bank application that tracks users’ financial transactions over time, allowing them to view their history over time.

About the Author

Matthew Stoodley is a programming enthusiast and has been really excited to learn about Rust for it’s low level power and memory safety. He mostly uses it to build board games.

If you want to try them, or you are looking for a story teller, magician, illustrator, or a web developer, you can go to his website to get to know him better.

Enroll now

What's inside

Learning objectives

  • Use the rust trait system to build super flexible types.
  • Effective ways of handling rust errors without boilerplate code.
  • How pointer lifetimes keep your code effective and safe.
  • Work within the restrictions needed for pointer safety, and still achieve capable code
  • How rust programs can work with other system programs.
  • Write programs that take full advantage of multicore processors, using concurrency without the risk of data races
  • Loop on anything with the iterator trait
  • How to use the rocket web framework to build powerful websites quickly

Syllabus

Getting Started with Basic Tools and Syntax

Understand how this series will help you learn Rust and how to use it effectively

Without Rust working on your machine it will be hard to test it out.

   •  Download the installer

   •  Run the installer

   •  Run your first Rust program

Read more

In order to write even the simplest program you have to understand the basic syntax

   •  Introduce functions and parameters

   •  Introduce variables and mutability

   •  Introduce printing syntax

Looping is core to programming anything useful

   •  Introduce “Loop” keyword

   •  Introduce “for” and “while”

   •  Introduce ranges and Iterators

Strings are a key mechanism for programs to interact with users and other programs.

   •  Learn the absolute basics on utf-8 and how rust handles that

   •  Learn about the difference between “&str” and “String”

   •  Learn to use String as function parameters

When dealing with complex systems it is helpful to organize your data in an orderly way

   •  Learn to define a struct

   •  Add methods to that struct.

   •  Call those methods on the struct

Handling data of different types can be challenging. Rust Enums provide a powerful mechanism for that.

   •  Learn to define an Enum

   •  Learn to match against different Variants

   •  Learn to add methods to the Enum

Error handling is tricky in any language. Rust provides two powerful classes to make that simple and safe

   •  Introduce Result and Error types

   •  Show some of their methods such as unwrap.

   •  Show how to use them in common cases

Make sure you have Rust installed and working, and understand some basic syntax

   •  Write a Rust program that greets everyone mentioned in the argument list whose name begins with “W”

Traits

Demonstrate how Traits are used for everything in Rust

   •  Create a new type

   •  Implement the “Add” Trait

   •  Show how this enables the “+” operator to work with it

In programming you often want to use other people’s libraries

   •  Include the Rand library

   •  Use the Rand library to generate random numbers

In order to define your own chosen behavior you need to define your own trait.

   •  Create a new trait

   •  Implement that trait

   •  Use that trait to do something

Some methods work well with any object as long as it meets a few requirements. Save rewriting the same code by making it Generic

   •  Introduce Generics

   •  Create a method that works a Generic type

   •  Call that method with specific concrete types

Some types, especially Collections, work will with any concrete type, as long as it meets a few requirements

   •  Create a new type that holds a Generic property

   •  Create a concrete object, with a specific type

   •  Call methods on that Generic type

All programming languages need to loop. In rust this is mostly done through the Iterator trait. We need to understand how to use it

   •  Introduce the Iterator trait

   •  Run a for loop

   •  Show what the for loop really does

There are some useful traits in the std library on rust. Knowing them makes programming in rust more efficient

   •  Introduce the Debug Trait

   •  Introduce the Clone Trait

   •  Introduce the Copy Trait

While Match on Result and Option can be powerful, it can be a lot of code to handle. We can make our code easier to read and write with the ‘?’

   •  Introduce the From Trait

   •  Show how the From trait can be used by ? To create convert between types

   •  Show how the? Uses the From type to make convert Errors

During this section we have been building a money library, how can we make it available for other people to use

   •  Introduce Crates.io

   •  Prepare our Crate (package) for upload

   •  Publish our crate

Make sure you have Rust installed and working, and understand some basic syntax

   •  Build a transaction library using the money type we created together

Lifetimes

To understand Lifetimes, We need to understand why they matter

   •  Try returning a pointer to a deleted object

   •  Show how rust prevents that

   •  Explain what security this provides

In rust you can pss data around by copying it, or by pointing to it. We need to understand when to do each

   •  Show how we can borrowing an object means we can call functions without losing the data

   •  Show how we can change things we are pointing to

   •  Show how the compiler protects us from mutating data that is currently borrowed elsewhere

Sometimes we don’t know how big our data will be. We need to be able to handle that.

   •  Introduce the Box. An owned pointer.

   •  Use that Box to enable recursive type definitions

   •  Build a Linked List using Box

Some pointers well never be invalid. How can we tell the compiler not to worry about them

   •  Introduce the “static” lifetime.

   •  Show how we can create static pointers

   •  Show where static pointers can come from in natural code

Sometimes we need to have multiple items access the same pointer.

   •  Introduce the Reference Count Rc

   •  Show how we can clone an Rc Object

   •  Show how when the last item goes out of scope the data is finally freed

Make sure you have Rust installed and working, and understand some basic syntax

   •  Build a binary Tree of names

   •  Traverse it tracking your position with pointers

The Program Environment

Operating System Environment Variables can hold useful information often about where to find files, We need to be able to read that.

   •  Show how to access environment variables

   •  Show the problems with testing against environment variables

   •  Show some testing techniques for working around, things outside your control

When working on a system with many programs available sometimes it us useful to get them to do the work for you

   •  Show how we can make system Calls

   •  Show how this library uses the Builder Pattern.

   •  Call a program passing command line arguments to it

Sometimes our program will need to act as a mediator between two other programs

   •  Show how pipes can be taken from programs output.

   •  Show how we can feed data into a programs input

   •  Call two programs and pass the output of one, into the other

The filesystem is a vital part of any operating system, we need to be able to access and save our own data, and sometimes other data

   •  Show how to open and read files

   •  Show how to write files

   •  Read one file, make changes and write it to a result

Make sure you have Rust installed and working, and understand some basic syntax

   •  Read a list of transactions, between users

   •  Write a file showing the final amount each user has

Threads and Channels

Modern Processors have multiple cores, each working simultaneously.. How can we take advantage of that to make our programs run faster

   •  Show how to launch a new thread

   •  Show how to wait for another thread to complete

   •  Show how to get the access the return result of a completed thread

Sometimes we need to tell another thread to do something, or pass other data to it so it can complete its job.

   •  Show how channels pass data between threads.

   •  Show how channels can be cloned

   •  Show how a when a channel is dropped, the receiver closes

Often, rather than use a channel, it can be much simple to share a single data item.

   •  Introduce Mutex, and show how it guarantees only one thread can access its data at a time

   •  Introduce Arc, and show how this enables us to Clone and Reference Count our Mutex

   •  Write a program that relies on a single mutex

Sometimes we have a lot of work to do that could be done concurrently. However creating a new thread for each task is expensive.

   •  Introduce the idea of a thread pool, or group of threads that wait for a task to do

   •  Introduce the idea of a job queue that we can add tasks to

   •  Show how different threads can take from that Job Queue, and quit when the queue is empty

Lots of jobs can be broken up into parts that do not need to interact with each other. Is there a simple way to break them apart?

   •  Show how to use Rayon to easily parallelize an iterated task

   •  Show how Rayon uses it’s Join method, internally to do this

   •  Write our own Parallel iterator using the Join method

Write a program that simulates 10 different users:

   •  In separate threads

   •  Creating an account

   •  Making Sending money to another user

Databases

Most Web Applications have a Database of some form at their back end. How can we handle that in rust?

   •  Download and install Sqlite

   •  Setup a database to handle transactions

   •  Test the database from within sqlite3

Secure Passwords

To add users and transactions we need to be able to edit our database

  • Show how to create a connection to Sqlite

  • Show how to prepare an edit statement

  • Show how to bind variables to it, and how to call the final edit command

To read a user’s balance we need to read a list of transactions out of the database.

  • Show how to prepare a read statement.

  • Show how to read rows from the returned response

  • Compile the rows into users balance

Create a command line database application allowing users to

  • Login

  • Pay someone

  • Check their balance

Building Our Database into an Online Banks

Rocket is a powerful Framework for creating Web applications. But it has a few requirements to be able to run on a normal system.

  • Introduce and install Nightly Rust.

  • Write a simple Rocket web server

  • Test our server’s response in a browser

Oten you need the html of your website to change dynamically.

  • Introduce the Maud html Generation system that uses Rust Macros, to generate extremely fast dynamic html.

  • Generate an html page with dynamic content

  • Test the contents of that page are what we want to see

To enable logins to last, we need a mechanism to store each user and associate some “cookie” or data item to them.

  • Create a Session List type that uses a Mutex and HashMap to store session data

  • Write methods for putting and getting sessions from this without needing “mut” externally

  • Test this actually creates a session correctly

From a html webpage we can send form data to a server, but how can we access it in rust.

  • Show how form data can be loaded into a Rocket function

  • Write a Rocket function that loads the Form Data into a user request

  • Create a new User in the database with that name

Http Cookies enable us to maintain a consistent session by tracking a small amount of data.

  • Show how to access a cookie and state object in Rocket

  • Use the cookie to store a SessionId, and access a user id

  • Use the UserId to make payments and check their balance

Create a mechanism for new users to Sign up, to Mini-Bank

  • Allow users to see a complete transaction history

  • Allow users to Logout

  • Add a session timeout

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Explores memory safety, which is standard in industry development
Taught by Packt Publishing, who are recognized for their work in software development
Develops pointer safety and lifetimes, which are core skills for programming
Examines multithreading without data races, which is highly relevant to concurrent programming
Builds a foundation for beginners in Rust
Teaches working with system programs, which is useful for software development

Save this course

Save Learn Rust in 7 Days to your list so you can find it easily later:
Save

Reviews summary

Good choice for rust basics

According to students, Learn Rust in 7 Days is a solid pick if you have previous programming experience and are looking for an introduction or refresher on the basics of Rust. The course offers good examples and goes beyond the trivial, giving you a good learning opportunity. However, this course may not be ideal if you are new to programming, as it moves quickly and doesn't always consider the needs of the student.
Good coverage of Rust basics.
"good depth of coverage"
"good learning opportunity"
"goes beyond the trivial"
Editing issues hinder learning.
"generally poor editing"
"author jumps around too much"
"video editing does not consider the needs of the student"

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Learn Rust in 7 Days with these activities:
Read Rust Programming Language
This book will provide an in-depth understanding of the Rust programming language.
Show steps
  • Read through the chapters of the book
  • Complete the exercises in the book
  • Research additional topics related to Rust
Contribute to Open Source Rust Projects
Contributing to Rust projects will improve your understanding of Rust and connect you with a community of developers.
Browse courses on Open Source
Show steps
  • Find a Rust project that interests you
  • Review the project's documentation and codebase
  • Identify an area where you can contribute
  • Submit a pull request with your contributions
Mentor Junior Rust Developers
Mentoring others will reinforce your understanding of Rust and allow you to share your knowledge with the community.
Browse courses on Mentorship
Show steps
  • Find junior Rust developers who are seeking mentorship
  • Establish regular communication channels
  • Provide guidance and support on Rust-related topics
  • Review their code and provide feedback
Show all three activities

Career center

Learners who complete Learn Rust in 7 Days will develop knowledge and skills that may be useful to these careers:
Backend Developer
Backend developers build and maintain the server-side of web applications. They work with databases, servers, and operating systems to ensure that websites and applications function smoothly. Rust is a powerful language for backend development, and this course provides a solid foundation in the language's core concepts. You'll learn about memory management, concurrency, and error handling, all of which are essential skills for a backend developer. Additionally, the course covers topics such as web frameworks and databases, which are commonly used in backend development.
Database Administrator
Database administrators are responsible for the design, implementation, and maintenance of databases. They work with database software, hardware, and operating systems to ensure that databases are reliable, efficient, and secure. Rust is a great language for database administration because it provides strong memory safety and concurrency guarantees. This course will teach you the basics of Rust, as well as how to use Rust to interact with databases. You'll also learn about database design and optimization, which are essential skills for a database administrator.
Web Developer
Web developers design and develop websites and web applications. They work with a variety of programming languages and technologies to create websites that are user-friendly, efficient, and secure. Rust is a great language for web development because it is fast, safe, and easy to learn. This course will teach you the basics of Rust, as well as how to use Rust to build web applications. You'll also learn about web development concepts such as HTML, CSS, and JavaScript.
Systems Administrator
Systems administrators are responsible for the maintenance and operation of computer systems. They work with hardware, software, and networks to ensure that systems are reliable, efficient, and secure. Rust is a great language for systems administration because it provides strong memory safety and concurrency guarantees. This course will teach you the basics of Rust, as well as how to use Rust to interact with operating systems and networks. You'll also learn about system administration concepts such as security, performance, and troubleshooting.
Software Engineer
Software engineers design, develop, and maintain software systems. They work with a variety of programming languages and technologies to create software that meets the needs of users. Rust is a popular language for software engineering because it is safe, efficient, and scalable. This course will teach you the basics of Rust, as well as how to use Rust to build software systems. You'll also learn about software design and architecture, which are essential skills for a software engineer.
IT Consultant
IT consultants help businesses solve technology problems. They work with clients to identify and assess their technology needs, and then develop and implement solutions. Rust is a great language for IT consulting because it is versatile and can be used to solve a wide range of problems. This course will teach you the basics of Rust, as well as how to use Rust to solve common IT problems. You'll also learn about IT consulting concepts such as project management, customer service, and technical support.
Computer Programmer
Computer programmers write, test, and maintain computer programs. They work with a variety of programming languages and technologies to create software that meets the needs of users. Rust is a popular language for computer programming because it is safe, efficient, and scalable. This course will teach you the basics of Rust, as well as how to use Rust to build computer programs. You'll also learn about programming concepts such as algorithms, data structures, and software design.
Network Administrator
Network administrators are responsible for the design, implementation, and maintenance of computer networks. They work with hardware, software, and protocols to ensure that networks are reliable, efficient, and secure. Rust is a great language for network administration because it provides strong memory safety and concurrency guarantees. This course will teach you the basics of Rust, as well as how to use Rust to interact with networks. You'll also learn about network administration concepts such as routing, switching, and security.
Data Analyst
Data analysts collect, analyze, and interpret data to help businesses make informed decisions. They work with a variety of data sources and tools to extract insights from data. Rust is a great language for data analysis because it is fast, efficient, and provides strong memory safety guarantees. This course will teach you the basics of Rust, as well as how to use Rust to analyze data. You'll also learn about data analysis concepts such as data mining, machine learning, and statistical analysis.
Mobile Developer
Mobile developers design and develop mobile applications for smartphones and tablets. They work with a variety of programming languages and technologies to create apps that are user-friendly, efficient, and secure. Rust is a great language for mobile development because it is fast, safe, and provides strong memory safety guarantees. This course will teach you the basics of Rust, as well as how to use Rust to build mobile applications. You'll also learn about mobile development concepts such as Android, iOS, and cross-platform development.
System Support Engineer
System support engineers provide technical support to users of software and hardware products. They work with users to troubleshoot problems, resolve issues, and provide training. Rust is a great language for system support because it provides strong memory safety guarantees. This course will teach you the basics of Rust, as well as how to use Rust to troubleshoot and resolve problems. You'll also learn about system support concepts such as problem solving, customer service, and technical support best practices.
Product Manager
Product managers are responsible for the development and launch of new products. They work with engineers, designers, and marketers to define the product vision, roadmap, and features. Rust is a great language for product management because it is versatile and can be used to build a wide range of products. This course will teach you the basics of Rust, as well as how to use Rust to build products. You'll also learn about product management concepts such as market research, user experience, and product launch.
Technical Writer
Technical writers create and maintain documentation for software and hardware products. They work with engineers, product managers, and marketers to develop documentation that is clear, accurate, and easy to understand. Rust is a great language for technical writing because it is well-documented and easy to learn. This course will teach you the basics of Rust, as well as how to use Rust to write technical documentation. You'll also learn about technical writing concepts such as style guides, documentation standards, and user experience.
Web Designer
Web designers create and maintain the look and feel of websites and web applications. They work with web developers to ensure that websites are visually appealing, user-friendly, and accessible. Rust is a great language for web design because it is fast and efficient. This course will teach you the basics of Rust, as well as how to use Rust to build web applications. You'll also learn about web design concepts such as HTML, CSS, and JavaScript.
Quality Assurance Analyst
Quality assurance analysts test and evaluate software to ensure that it meets quality standards. They work with developers and testers to identify and fix bugs, and to improve the overall quality of software. Rust is a great language for quality assurance because it provides strong memory safety guarantees. This course will teach you the basics of Rust, as well as how to use Rust to test and evaluate software. You'll also learn about quality assurance concepts such as testing methodologies, test automation, and defect tracking.

Reading list

We've selected six books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Learn Rust in 7 Days.
Comprehensive guide to the Rust programming language. It covers all the basics of the language, as well as more advanced topics such as concurrency and memory management. It valuable resource for anyone who wants to learn more about Rust.
Practical guide to Rust programming. It covers a wide range of topics, from basic syntax to advanced topics such as concurrency and memory safety. This book would be a valuable resource for anyone who wants to learn more about Rust.
Comprehensive overview of the Rust programming language. It covers everything from basic syntax to advanced topics like concurrency and memory management. It great resource for anyone who wants to learn more about Rust and how to use it effectively.
Provides a comprehensive overview of the Rust programming language for data science. It covers everything from basic syntax to advanced topics like concurrency and memory management. It great resource for anyone who wants to learn more about Rust and how to use it to build data science applications.
Comprehensive guide to Rust programming. It covers all the basics of the language, as well as more advanced topics such as concurrency and memory management. It valuable resource for anyone who wants to learn more about Rust.
Collection of Rust code examples. It covers a wide range of topics, from the basics of the language to more advanced topics such as concurrency and memory management. It valuable resource for anyone who wants to learn more about Rust.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Learn Rust in 7 Days.
Memory Ownership and Borrowing in Rust 2021
Most relevant
Rust 2021 Fundamentals
Most relevant
Fundamentals with Rust: Build a CLI Distance Calculator
Most relevant
Rust: The Complete Developer's Guide
Most relevant
RESTful API with Rust: Build a Game Map Server
Most relevant
Debugging Rust 2021 Applications
Most relevant
Rust for Large Language Model Operations (LLMOps)
Most relevant
Rust Fundamentals
Most relevant
Python and Rust with Linux Command Line Tools
Most relevant
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser