Practical Rust Projects -  Shing Lyu

Practical Rust Projects (eBook)

Building Game, Physical Computing, and Machine Learning Applications

(Autor)

eBook Download: PDF
2020 | 1st ed.
XIII, 257 Seiten
Apress (Verlag)
978-1-4842-5599-5 (ISBN)
Systemvoraussetzungen
36,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

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. 

 




Shing Lyu is a software engineer who is passionate about open source software. He's worked on Rust professionally at Mozilla, on the Firefox (Gecko) and Servo browser engine project. Currently, he is working at DAZN, a sports streaming platform as a backend developer, with a focus on AWS and serverless technology. Shing has worked for many world famous brands such as Mozilla and Intel. He is also active in the open source community.  Being one of the founders of the Taiwan Rust community, he loves to share his enthusiasm for Rust with people.


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 ForSomeone with basic Rust knowledge, wishing to learn more about how to apply Rust in a real-world scenario.  

Table of Contents 5
About the Author 10
About the Technical Reviewer 11
Chapter 1: Welcome to the  World of Rust 12
Who Is This Book For? 13
Who Is This Book Not For? 14
Criteria for Selecting Libraries 15
Pure Rust 15
Maturity 16
Popularity 16
How To Use This Book 17
Chapter Overview 17
Source Code 18
Chapter 2: Building a Command-Line Program 20
Introduction 20
What Are You Building? 21
Creating a Binary Project 22
Reading Command-Line Arguments with std::env::args 23
Handling Complex Arguments with StructOpt 25
Adding Binary Flags (aka Switches) 29
Printing to STDERR 30
Printing with Color 32
Reading the Cat Picture from a File 33
Better Error Handling 37
Piping to Other Commands 42
Piping to STDOUT Without Color 43
Accepting STDIN 44
Integration Testing 45
Publishing and Distributing the Program 50
Install from Source 50
Publish to crates.io 51
Building Binaries for Distribution 52
Conclusion 53
Chapter 3: Creating Graphical User Interfaces (GUIs) 54
What Are You Building? 55
Building a Text-Based User Interface 57
Showing a Dialog Box 59
Handling Simple Keyboard Inputs 61
Adding a Dialog 62
Multi-Step Dialogs 64
Reading User Input 67
Moving to Graphical User Interfaces (GUIs) 70
Creating a Window 71
Displaying an Image 74
Using Glade to Design the UI 77
Accepting Inputs and Button Clicks 88
Reading a gtk::Switch 93
Other Alternatives 96
Chapter 4: Building a Game 97
What Are You Building? 97
Amethyst and the Entity-Component-System Pattern 98
Creating an Amethyst Project 100
Creating a Window 102
Seeing the World Through a Camera 107
Adding the Cats 110
Moving the Cats 119
Creating the Ball 127
Can’t Defy Gravity 131
Making the Ball Bounce 135
Keeping Score 142
Let There Be Music 152
Other Alternatives 163
Chapter 5: Physical Computing in Rust 165
What Are You Building? 166
Physical Computing on Raspberry Pi 167
Getting to Know Your Raspberry Pi 167
Install Raspbian Through NOOBS 168
Install the Rust Toolchain 170
Controlling the GPIO Pins 171
Building a LED Circuit 173
Controlling the GPIO Output from Rust 176
Reading Button Clicks 180
Cross-Compiling to Raspberry Pi 187
How Does the GPIO Code Work? 189
Where Do You Go from Here? 194
Chapter 6: Artificial Intelligence and Machine Learning 196
What Is Machine Learning? 196
Supervised vs. Unsupervised Learning 197
What Are You Building? 198
Introducing the rusty-machine Crate 200
Clustering Cat Breeds with K-Means 202
Introduction to the K-Means Algorithm 202
The Training Data 204
Exporting as CSV 209
Moving the Configuration Into a File 211
Visualizing the Data 216
Setting Up K-Means 220
Detecting Cats versus Dogs with the  Neural Network 227
Introduction to Neural Networks 227
Preparing the Training and Testing Data 230
Setting Up the Neural Network Model 233
Reading the Training and Testing Data 233
Normalizing the Training Data 236
Training and Predicting 239
Making the Prediction 241
Other Alternatives 243
Chapter 7: What Else Can You Do with Rust? 245
The End Is Just the Beginning 245
The Web 245
Backend 246
Frontend 249
Web Browser and Crawler 250
Mobile 252
Operating Systems and Embedded Devices 256
Unlimited Possibilities of Rust 257
Index 259

Erscheint lt. Verlag 27.2.2020
Zusatzinfo XIII, 257 p. 56 illus., 42 illus. in color.
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Grafik / Design
Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Informatik Software Entwicklung Mobile- / App-Entwicklung
Informatik Software Entwicklung Spieleprogrammierung
Informatik Theorie / Studium Compilerbau
Schlagworte Applications • Apps • Case Studies • Embedded • Game • Mobile • Practical • programming • Projects • Rust • source code
ISBN-10 1-4842-5599-2 / 1484255992
ISBN-13 978-1-4842-5599-5 / 9781484255995
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 4,5 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Robust and fast cross-platform application development

von Marco Cantu; Pawel Glowacki

eBook Download (2024)
Packt Publishing Limited (Verlag)
33,59