Go beyond the basics and build complete applications using the Rust programming language, updated for Rust 2021 edition. The applications you'll build over the course of this book include a high-performance web client, an embedded computer (for a robot, for example), a game, a serverless web app, and an application that incorporates AI and machine learning.
Each chapter is organized in the following format: what the kind of should application look like; requirements and user stories of our example program; an introduction to the Rust libraries used; the actual implementation of the example program, including common pitfalls and their solutions; and a brief comparison of libraries for building each application, if there is no clear preference.
Practical Rust Projects, Second Edition will open your eyes to how Rust can be put to practical, real-world use. After reading this book, you will be able to use Rust to build a variety of your own projects.
What You Will Learn
Explore practical Rust programming language-based projects, examples and case studies
Create a GUI
Build a high performance web Front-end using WebAssembly
Develop REST APIs using Rust
Go serverless to develop a cloud application using the Amazon AWS Rust SDK
Create a game using Rust, along with AI and machine learning apps
Who This Book Is For
Those with basic Rust knowledge who want to learn more about how to apply Rust in real-world scenarios.
Author(s): Shing Lyu, Andrew Rzeznik
Edition: 2
Publisher: Apress
Year: 2023
Language: English
Pages: 397
Table of Contents
About the Authors
About the Technical Reviewer
Introduction
Chapter 2: Building a Command-line Program
2.1 What Are You Building?
2.2 Creating a Binary Project
2.3 Reading Command-line Arguments with std::env::args
2.4 Handling Complex Arguments with Clap
2.5 Adding Binary Flags
2.6 Printing to STDERR
2.7 Printing with Color
2.8 Reading the Cat Picture from a File
2.9 Handling Errors
2.10 Piping to Other Commands
Piping to STDOUT Without Color
Accepting STDIN
2.11 Integration Testing
2.12 Publishing and Distributing the Program
Install from Source
Publish to crates.io
Building Binaries for Distribution
2.13 Conclusion
Chapter 3: Creating Graphical User Interfaces (GUIs)
3.1 What Are You Building?
3.2 Building a Text-based User Interface
3.3 Showing a Dialog Box
3.4 Handling Simple Keyboard Inputs
3.5 Adding a Dialog
3.6 Multi-step Dialogs
3.7 Reading User Input
3.8 Moving to Graphical User Interfaces (GUIs)
3.9 Creating a Window
3.10 Displaying an Image
3.11 Using Glade to Design the UI
3.12 Accepting Inputs and Button Clicks
3.13 Reading a gtk::Switch
3.14 Alternatives
3.15 Conclusion
Chapter 4: High-Performance Web Frontend Using WebAssembly
4.1 What Is WebAssembly?
4.2 What Are You Building?
4.3 Hello WebAssembly!
Setting Up the Development Environment
Creating the Project
Creating the Frontend
4.4 Resizing an Image with WebAssembly
Loading an Image File onto the