Preface

This book is a presentation of the most interesting and useful libraries and frameworks that are freely available for Rust programmers to use in building interesting and useful projects, such as frontend and backend web applications, games, interpreters, compilers, computer emulators, and Linux-loadable modules.

Who this book is for

This book is for developers who have already learned the Rust programming language and are eager to put it to work to build useful software, whether for businesses or for a hobby project. The book addresses diverse needs, such as building a web application, a computer game, an interpreter, a compiler, an emulator, or a device driver.

Some knowledge of SQL is required to understand the chapter on databases, and knowledge of the C programming language and Linux tools is required to understand the chapter on Linux modules.

What this book covers

Chapter 1, Rust 2018 – Productivity, describes recent innovations in the Rust language and its ecosystem of tools and libraries. In particular, it shows you how to use some utility libraries that are in widespread usage.

Chapter 2,Storing and Retrieving Data, describes how to read and write some of the most popular text file formats in the Rust world: TOML, JSON, and XML. It also describes how to access some of the most popular database engines in the Rust world, such as SQLite, PostgreSQL, and Redis.

Chapter 3,Creating a REST Web Service, describes how to use the Actix framework to develop a REST service that can be used as a backend for any kind of client application, particularly web applications.

Chapter 4,Creating a Full Server-Side Web App, describes how to use the Tera template engine to replace placeholders in a text file, and how to use the Actix framework to create a full server-side web application.

Chapter 5,Creating a Client-Side WebAssembly App Using Yew,describes how to use the Yew framework, which exploits the WebAssembly technology, to create the frontend of a web application.

Chapter 6,Creating a WebAssembly Game Using Quicksilver, describes how to use the Quicksilver framework to create graphical 2D games that can be run in a web browser, exploiting the WebAssembly technology, or as a desktop application.

Chapter 7,Creating a Desktop Two-Dimensional Game Using ggez, describes how to use the ggez framework to create graphical 2D games for desktop, including the coverage of widgets.

Chapter 8,Using a Parser Combinator for Interpreting and Compiling, describes how to use the Nom parser combinator to create parsers of formal languages and then build syntax checkers, interpreters, and compilers.

Chapter 9,Creating a Computer Emulator Using Nom, describes how to use the Nom library to parse binary data and interpret a machine language program, which is the first step in building a computer emulator.

Chapter 10,Creating a Linux Kernel Module, describes how to build Linux loadable modules using Rust, focusing on the Mint distribution; specifically, a character device driver will be built.

Chapter 11,The Future of Rust, describes the innovations that are probably going to appear in the next few years in the Rust ecosystem. In particular, the new asynchronous programming technique is briefly shown.

To get the most out of this book

Software/hardware covered in the book OS requirements
You will need version 1.31 of Rust (from December 2018) or a newer version installed on your computer. The content of this book was tested on 64-bit Linux Mint and 32-bit Windows 10 systems. Most examples should work on any system supporting Rust.Chapter 5,Creating a Client-Side WebAssembly App Using Yew, andChapter 6,Creating a WebAssembly Game Using Quicksilver, require a web browser that supports WebAssembly, such as Chrome or Firefox.Chapter 6,Creating a WebAssembly Game Using Quicksilver, andChapter 7,Creating a Desktop Two-Dimensional Game Using ggez, require support for OpenGL.Chapter 10,Creating a Linux Kernel Module, works only on Linux Mint.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related tothe copying and pasting of code.

Download the example code files

You can download the example code files for this book from your account atwww.packt.com. If you purchased this book elsewhere, you can visitwww.packtpub.com/supportand register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register atwww.packt.com.
  2. Select theSupporttab.
  3. Click onCode Downloads.
  4. Enter the name of the book in theSearchbox and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub athttps://github.com/PacktPublishing/Creative-Projects-for-Rust-Programmers. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:https://static.packt-cdn.com/downloads/9781789346220_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText:Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles.Here is an example:"The pos variable is the position of the current digit in the digits array."

A block of code is set as follows:

{
for pos in pos..5 {
print!("{}", digits[pos] as u8 as char);
}

Any command-line input or output is written as follows:

          curl -X GET http://localhost:8080/datafile.txt
        

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "The Name portion edit box and the Filter button to its right are for filtering the table below it, in a similar way to the list project."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book,mention the book title in the subject of your message and email us at[email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visitwww.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at[email protected]with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visitauthors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset