Rust Intermediate

Intermediate Rust

Rust Intermediate

Overview

In the previous book, you learned about the basics of the Rust programming language. You got a feel for the language and even wrote your first code.

You learned how to start and build projects using Cargo and even begun a milestone project you can add to your portfolio.

This intermediate-level book dives deeper into Rust's features and concepts, enabling readers to develop more complex and robust applications.

Practical examples, exercises, and a hands-on project will ensure that you build confidence and competence in intermediate Rust programming.

Let’s get started.

Advanced-Data Structures in Rust

Aside from data types and primary data structures, Rust supports more advanced data structures like HashMaps and Sets. Before we look into them, let’s refresh our memory on the Vector data structure.

Explore this Resource

Advanced Methods, Enums, and Pattern Matching

We have seen how methods work: when there is a struct, a method must be implemented for that struct to be able to use the data in the struct. Methods are also defined for enums and traits — concepts that we will explore after now. For now, let’s revise some of the constructs of method implementations in general.

Explore this Resource

Traits and Generics in Rust

In our earlier exploration of the Result and Option enums, you encountered using <T, E> and <T> within angle brackets. These constructs are known as generics. Generics are a powerful feature in programming that allows you to write functions, types, and structures that can work with different data types while maintaining type safety and code reusability.

Explore this Resource

Lifetimes in Rust

Lifetimes are a fundamentally important concept in Rust that ensures that references remain valid and prevent issues like dangling pointers or references to memory that have been deallocated. To write safe and efficient Rust code, you must understand lifetimes and how to use them. This is one of Rust’s most unique trademark features.

Explore this Resource

Advanced Functions and Closures

By now, you must be good at writing functions in Rust. If you have prior programming experience, you would know that functions sometimes accept pointers as parameters. If you know functional programming, you must have heard about higher-order functions and closures. Let’s take them step by step.

Explore this Resource

Concurrency and Multithreading in Rust

This chapter will explore the world of concurrency and multithreading in Rust. Concurrency allows you to handle multiple tasks simultaneously, while multithreading takes advantage of multiple CPU cores for parallel execution. Rust's strong ownership and type system help ensure safe and efficient concurrent programming.

Explore this Resource

Error Handling in Rust

In this chapter, we'll delve into Rust's intricacies of error handling. Effective error handling is a cornerstone of robust and reliable software. We'll explore the Result and Option types, learn how to use the match and ? operators for error handling, implement custom error types using the thiserror crate, and discover how the Result type aids in early returns within functions. This chapter will use real-world backend engineering scenarios to illustrate each concept.

Explore this Resource

File I/O and Serialization

This comprehensive chapter will explore Rust's file input/output (I/O) operations and serialization. These topics are crucial for handling data in backend applications. We'll explore how to read and write files, perform serialization and deserialization using the serde crate, and work with various file formats like JSON and YAML. This chapter will use practical examples from a backend engineering perspective.

Explore this Resource

Milestone Project: Building a Task Management App

We'll build a task management application using Rust in this exciting milestone project. This project will encompass concepts covered in the previous chapters, including structuring your code, error handling, file I/O, and more. Following these steps, you'll create a functional task manager allowing users to add, list, and mark tasks as completed.

Explore this Resource

Whenever you're ready

There are 4 ways we can help you become a great backend engineer:

The MB Platform

Join 1000+ backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learnings and set schedules, and solve backend engineering tasks, exercises, and challenges.

The MB Academy

The “MB Academy” is a 6-month intensive Advanced Backend Engineering BootCamp to produce great backend engineers.

Join Backend Weekly

If you like post like this, you will absolutely enjoy our exclusive weekly newsletter, Sharing exclusive backend engineering resources to help you become a great Backend Engineer.

Get Backend Jobs

Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board