Rust is a systems programming language focused on three main goals: safety, speed, and concurrency. This makes Rust usable in areas where few languages dare to tread: embedded systems, device drivers, and operating system development, to name a few. Rust doesn’t skimp on the higher-level features though – with a sophisticated type system and a number of modern conveniences, Rust manages to make systems programming easier, safer and faster.
From basic programming patterns to a peek under the hood of the language, this book aims to help you move from writing programs to building software in Rust. Step Ahead with Rust will show you the most important features of the Rust language, including Cargo, Type System, Iterators and more. By the end of this book, you should be familiar with far more of them, and ready to tackle the rest of advanced topics. As you progress through the book, we recommend taking the time to experiment with what is presented in its pages. This book is all about the practical application of Rust, so applying it in practice is expected.
A Step Ahead with Rust reader is expected to be a moderately experienced developer looking to improve their Rust development skills.
The book covers:
- Cargo
- Rust Type System
- Iterators
- Macros
- Ownership, Borrowing and Lifetimes
- Unsafe Patterns
- Concurrency
Table of Contents
About the Authors
Acknowledgements
Preface
1 Introduction & History of Rust
History
2 Cargo
Overview
Generating a Basic Manifest File
Build Targets
Building your Crate
Generating Documentation
Manifest File
Semantic Versioning
Publishing Crates
Expansion Commands for Cargo
Key Takeaways
3 Type System
Types & Values
Primitive Types
Structs and Enums
Algebraic Data Types
Traits
Generic Types
Dynamically Sized Types
Key Takeaways
4 Extending Types
Adding Functionality
Extending Collections
Conversion Traits
Re-Implementing Traits
Type Safety
Key Takeaways
5 Ownership, Borrowing & Lifetimes
Ownership
Borrowing
Lifetimes
Key Takeaways
6 Iterators
Introduction
Iterator
Adapters
Consumers
Building your own Iterator
Building your own Adapter
Other Iterator Traits
Streaming Iterators
Limitations
Cursors
Key Takeaways
7 Concurrency
Message Passing Concurrency
Shared Memory Concurrency
Key Takeaways
8 Type-Safe Idiomatic Code
The Builder Pattern
Resource Acquisition is Initialization (RAII)
Type-Safe State Machines
Key Takeaways
9 Writing Tested Code
A Minimum Binary Heap
Simple Unit Testing
Property-Based Unit Testing
Integration Testing
Documentation Testing
Benchmarking
Key Takeaways
10 Macros
A Brief Introduction to Rust Macros
Designing a Macro
Advanced Macros
Key Takeaways
11 Foreign Function Interface
Binding to Foreign Code
Exposing Rust
Key Takeaways
12 InteriorMutability
What and Why?
Cell and RefCell
Where to Use Interior Mutability
UnsafeCell
Key Takeaways
13 UnsafeRust
Systems Programming
Key Takeaways
Index
Reviews
There are no reviews yet.