Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Rust

You're reading from   Learning Rust A comprehensive guide to writing Rust applications

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781785884306
Length 308 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Vesa Kaihlavirta Vesa Kaihlavirta
Author Profile Icon Vesa Kaihlavirta
Vesa Kaihlavirta
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Title Page
Preface
1. Introducing and Installing Rust FREE CHAPTER 2. Variables 3. Input and Output 4. Conditions, Recursion, and Loops 5. Remember, Remember 6. Creating Your Own Rust Applications 7. Matching and Structures 8. The Rust Application Lifetime 9. Introducing Generics, Impl, and Traits 10. Creating Your Own Crate 11. Concurrency in Rust 12. Now It's Your Turn! 13. The Standard Library 14. Foreign Function Interfaces

Preface

Rust is a new programming language. It offers performance and safety that is equivalent to, or even surpasses, modern C++ while being a modern language with a relatively low barrier to entry. Rust's momentum, combined with its active and friendly community, promise a great future for the language.

While modern and fluent, Rust is not a particularly easy language. The memory management system keeps track of the life of every entity that is used in your program and is designed in such a way that this tracking can typically happen entirely at compile time. The Rust programmer's burden is to help the compiler when it cannot decide for itself what should happen. Since modern programming is possible without ever facing such responsibilities, a modern programmer may not immediately feel comfortable with Rust.

However, like all expertise and skill, the more difficult it is to attain, the more valuable it is, and this book is here to help you. This book covers the basics of Rust, enabling you to gain enough skills to start programming with it.

What this book covers

Chapter 1, Introducing and Installing Rust, deals with installing the Rust toolset and using the basic tools.

Chapter 2, Variables, focuses on using different kinds of variables.

Chapter 3, Input and Output, covers the basic I/O.

Chapter 4, Conditions, Recursion, and Loops, goes through the different loops and iterative methods of Rust.

Chapter 5, Remember, Remember, covers Rust's memory handling system.

Chapter 6, Creating Your Own Rust Applications, gives you the task of building a complete Rust application.

Chapter 7, Matching and Structures, teaches you compound data types and how to destructure them.

Chapter 8, The Rust Application Lifetime, covers Rust's unique ownership, borrowing, and lifetime system, which enables resource safety without garbage collection.

Chapter 9, Introducing Generics, Impl, and Traits, goes through Rust's generic types.

Chapter 10, Creating Your Own Crate, instructs you how to build your own contained packages of Rust code.

Chapter 11Concurrency in Rust, looks at concurrency and parallelism techniques.

Chapter 12, Now It's Your Turn!, gives you another set of tasks to complete.

Chapter 13, The Standard Library, covers Rust's standard library.

Chapter 14, Foreign Function Interfaces, introduces techniques to interface Rust code with C programs.

What you need for this book

To really dive into the content of this book, you should write out the example code and do the exercises. For that, you'll need a fairly recent computer; a gigabyte of RAM should be enough for the purposes of this book, but the more you have the faster the builds will be.

Linux is the best supported operating system here, but Rust itself is a first-class citizen on macOS and recent versions of Windows, so all the examples should adapt well there.

Who this book is for

This book will appeal to application developers who would like to build applications with Rust. No knowledge of programming is required.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "A shorter form is available in the unwrap method. This is the same as the expect method, but it doesn't print out anything in case of a failure."

A block of code is set as follows:

let mut file = File::create("myxml_file.xml).unwrap(); 
let mut output = io::stdout(); 
let mut input = io::stdin(); 

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

cd app_name cargo build app_name

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Open up Visual Studio Code and go to the Command Palette, either by the View menu or by the keyboard shortcut Ctrl + Shift + P (which may differ between platforms)."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply email [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed directly to you. You can download the code files by following these steps:

  1. Log in or register to our website using your email address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

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 at https://github.com/PacktPublishing/Learning-Rust. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

 

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images