Skip to main content
Top

2020 | Book

Practical Rust Projects

Building Game, Physical Computing, and Machine Learning Applications

insite
SEARCH

About this book

Go beyond the basics and build complete applications using the Rust programming language. The applications in this book include a high-performance web client, a microcontroller (for a robot, for example), a game, an app that runs on Android, and an application that incorporates AI and machine learning.

Each chapter will be organized in the following format: what this kind of application looks 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 winner.

Practical Rust Projects will open your eyes to the world of practical applications of Rust. After reading the book, you will be able to apply your Rust knowledge to build your own projects.

What You Will Learn

Write Rust code that runs on microcontrollers Build a 2D game Create Rust-based mobile Android applications Use Rust to build AI and machine learning applications

Who This Book Is For

Someone with basic Rust knowledge, wishing to learn more about how to apply Rust in a real-world scenario.

Table of Contents

Frontmatter
Chapter 1. Welcome to the World of Rust
Abstract
If you are reading this book, you are probably as excited about Rust as I am. Since its first stable release in 2015, Rust has come a long way in terms of features and stability. Developers around the world are fascinated about how Rust can combine features that were once thought as unavoidable tradeoffs: performance with memory safety and low-level control with productivity. Despite the infamous steep learning curve, Rust has gained popularity over the years. It was named the “most loved programming language” in the StackOverflow survey four years in a row, from 2016 to 2019. Many big companies and organizations, including Facebook, Microsoft, Dropbox, and npm, have started using Rust in production.
Shing Lyu
Chapter 2. Building a Command-Line Program
Abstract
Command-line programs, also known as CLIs (command-line interfaces), are one of the most natural applications of Rust. When you compile your first Hello World program, you are building a command-line program. A typical command-line program takes arguments, flags, and sometimes standard input and then executes its main algorithm and output to the standard output or file. All these operations are well supported by the Rust standard library and the third-party crates on crates.io.
Shing Lyu
Chapter 3. Creating Graphical User Interfaces (GUIs)
Abstract
Command-line tools are handy when you need small tools that don’t require visual interaction or batch processing. But a command-line program’s user interface is usually limited to text input/output and files. This is sometimes not sufficient when 2D (or even 3D) visual interaction is required. So this chapter breaks out of the constraint of the command-line interface and talks about graphical user interfaces (GUIs).
Shing Lyu
Chapter 4. Building a Game
Abstract
Video games have come a long way from their early days. The Super Mario Bros for NES ran on an 8-bit CPU that had a 1.79MHz clock rate. The game itself is roughly 31KB. Nowadays, you can easily get a gaming PC that has an 8-core CPU running at 35GHz each, and games that are 50-70GB. That is thousands of times more computing power and millions of times more storage space. Games are growing more and more complex as well, so the life of a game programmer is becoming tougher than before.
Shing Lyu
Chapter 5. Physical Computing in Rust
Abstract
Up until now, all the programs you have written exist only in the virtual world. However, a big part of the physical world is controlled by software. Traffic lights, self-driving cars, airplanes, and even rockets and satellites are just a few examples. Much of this software has to be compiled and executed in a drastically different environment than the usual Linux, Windows, or MacOS desktop or laptop computers. They usually have to run on relatively weaker CPUs with less available memories. They might sometimes need to run without an operating system, or on specialized operating systems designed specifically for embedded systems.
Shing Lyu
Chapter 6. Artificial Intelligence and Machine Learning
Abstract
Artificial intelligence and machine learning have always been hot topics in news and science fiction. Recently they got more media attention because of technology breakthroughs in deep learning and more consumer-facing applications on the market. The terms machine learning and artificial intelligence are sometimes used interchangeably, but there is a subtle difference. Artificial intelligence focuses on “intelligence”. An AI system tries to behave as if it possesses human intelligence, no matter what the underlying method or algorithm is. But in machine learning, the focus is on “learning,” where the system is trying to learn something from the data without a human explicitly programming the knowledge. For example, one of the early successes in AI was the expert system. In an expert system, the knowledge of a particular field is written down as rules and programmed directly into the code, so the system can answer questions or perform tasks as if it were a domain expert. This kind of system might appear to have some level of human intelligence, but underneath it’s not actually “learning” from data. So this system can be called an AI system but not a machine learning system.
Shing Lyu
Chapter 7. What Else Can You Do with Rust?
Abstract
You’ve been on an exciting journey through the world of Rust. You’ve learned how to build a CLI, a GUI, a game, physical devices, and machine learning models. What next steps can you take? What other exciting applications can you build with Rust? This chapter briefly walks you through some other areas that aren’t covered in depth in this book.
Shing Lyu
Backmatter
Metadata
Title
Practical Rust Projects
Author
Shing Lyu
Copyright Year
2020
Publisher
Apress
Electronic ISBN
978-1-4842-5599-5
Print ISBN
978-1-4842-5598-8
DOI
https://doi.org/10.1007/978-1-4842-5599-5

Premium Partner