Rust Essentials - Second Edition

Leverage the functional programming and concurrency features of Rust and speed up your application development
Preview in Mapt

Rust Essentials - Second Edition

Ivo Balbaert

Leverage the functional programming and concurrency features of Rust and speed up your application development
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $35.99
Save 72%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Rust Essentials - Second Edition Book Cover
Rust Essentials - Second Edition
$ 35.99
$ 10.00
AWS Administration - The Definitive Guide - Second Edition Book Cover
AWS Administration - The Definitive Guide - Second Edition
$ 35.99
$ 10.00
Buy 2 for $20.00
Save $51.98
Add to Cart

Book Details

ISBN 139781788390019
Paperback264 pages

Book Description

Rust is the new, open source, fast, and safe systems programming language for the 21st century, developed at Mozilla Research, and with a steadily growing community. It was created to solve the dilemma between high-level, slow code with minimal control over the system, and low-level, fast code with maximum system control. It is no longer necessary to learn C/C++ to develop resource intensive and low-level systems applications. This book will give you a head start to solve systems programming and application tasks with Rust.

We start off with an argumentation of Rust's unique place in today's landscape of programming languages. You'll install Rust and learn how to work with its package manager Cargo. The various concepts are introduced step by step: variables, types, functions, and control structures to lay the groundwork. Then we explore more structured data such as strings, arrays, and enums, and you’ll see how pattern matching works.

Throughout all this, we stress the unique ways of reasoning that the Rust compiler uses to produce safe code. Next we look at Rust's specific way of error handling, and the overall importance of traits in Rust code. The pillar of memory safety is treated in depth as we explore the various pointer kinds. Next, you’ll see how macros can simplify code generation, and how to compose bigger projects with modules and crates. Finally, you’ll discover how we can write safe concurrent code in Rust and interface with C programs, get a view of the Rust ecosystem, and explore the use of the standard library.

Table of Contents

Chapter 1: Starting with Rust
The advantages of Rust
The stability of Rust and its evolution
The success of Rust
Servo
Installing Rust
rustc--the Rust compiler
Our first program
Developer tools
The Standard Library
Summary
Chapter 2: Using Variables and Types
Comments
Global constants
Values and primitive types
Binding variables to values
Scope of a variable and shadowing
Type checking and conversions
Expressions
The stack and the heap
Summary
Chapter 3: Using Functions and Control Structures
Branching on a condition
Looping
Functions
Attributes
Testing
Summary
Chapter 4: Structuring Data and Matching Patterns
Strings
Arrays, vectors, and slices
Tuples
Structs
Enums
Getting input from the console
Matching patterns
Program arguments
Summary
Chapter 5: Higher Order Functions and Error-Handling
Higher order functions and closures
Iterators
Consumers and adapters
Generic data structures and functions
Error-handling
Summary
Chapter 6: Using Traits and OOP in Rust
Associated functions on structs
Methods on structs
Using a constructor pattern
Using a builder pattern
Methods on tuples and enums
Traits
Using trait constraints
Static and dynamic dispatch
Built-in traits and operator overloading
OOP in Rust
Inheritance with traits
Using the visitor pattern
Summary
Chapter 7: Ensuring Memory Safety and Pointers
Pointers and references
Ownership and borrowing
Boxes
Reference counting
Overview of pointers
Summary
Chapter 8: Organizing Code and Macros
Modules and crates
Macros
Summary
Chapter 9: Concurrency - Coding for Multicore Execution
Concurrency and threads
Shared mutable states
Communication through channels
Summary
Chapter 10: Programming at the Boundaries
When is code unsafe
Raw pointers
Interfacing with C
Inlining assembly code
Calling Rust from other languages
Summary
Chapter 11: Exploring the Standard Library
Exploring std and the prelude module
Collections - using hashmaps and hashsets
Working with files
Using Rust without the Standard Library
Summary
Chapter 12: The Ecosystem of Crates
The ecosystem of crates
Working with dates and times
File formats and databases
Web development
Graphics and games
OS and embedded system development
Other resources for learning Rust
Summary

What You Will Learn

  • Set up your Rust environment to achieve the highest productivity
  • Bridge the performance gap between safe and unsafe languages
  • Use pattern matching to create flexible code
  • Apply generics and traits to develop widely applicable code
  • Organize your code in modules and crates
  • Build macros to extend Rust’s capabilities and reach
  • Apply tasks to tackle problems concurrently in a distributed environment

Authors

Table of Contents

Chapter 1: Starting with Rust
The advantages of Rust
The stability of Rust and its evolution
The success of Rust
Servo
Installing Rust
rustc--the Rust compiler
Our first program
Developer tools
The Standard Library
Summary
Chapter 2: Using Variables and Types
Comments
Global constants
Values and primitive types
Binding variables to values
Scope of a variable and shadowing
Type checking and conversions
Expressions
The stack and the heap
Summary
Chapter 3: Using Functions and Control Structures
Branching on a condition
Looping
Functions
Attributes
Testing
Summary
Chapter 4: Structuring Data and Matching Patterns
Strings
Arrays, vectors, and slices
Tuples
Structs
Enums
Getting input from the console
Matching patterns
Program arguments
Summary
Chapter 5: Higher Order Functions and Error-Handling
Higher order functions and closures
Iterators
Consumers and adapters
Generic data structures and functions
Error-handling
Summary
Chapter 6: Using Traits and OOP in Rust
Associated functions on structs
Methods on structs
Using a constructor pattern
Using a builder pattern
Methods on tuples and enums
Traits
Using trait constraints
Static and dynamic dispatch
Built-in traits and operator overloading
OOP in Rust
Inheritance with traits
Using the visitor pattern
Summary
Chapter 7: Ensuring Memory Safety and Pointers
Pointers and references
Ownership and borrowing
Boxes
Reference counting
Overview of pointers
Summary
Chapter 8: Organizing Code and Macros
Modules and crates
Macros
Summary
Chapter 9: Concurrency - Coding for Multicore Execution
Concurrency and threads
Shared mutable states
Communication through channels
Summary
Chapter 10: Programming at the Boundaries
When is code unsafe
Raw pointers
Interfacing with C
Inlining assembly code
Calling Rust from other languages
Summary
Chapter 11: Exploring the Standard Library
Exploring std and the prelude module
Collections - using hashmaps and hashsets
Working with files
Using Rust without the Standard Library
Summary
Chapter 12: The Ecosystem of Crates
The ecosystem of crates
Working with dates and times
File formats and databases
Web development
Graphics and games
OS and embedded system development
Other resources for learning Rust
Summary

Book Details

ISBN 139781788390019
Paperback264 pages
Read More

Read More Reviews

Recommended for You

Python: End-to-end Data Analysis Book Cover
Python: End-to-end Data Analysis
$ 71.99
$ 10.00
Information Security Handbook Book Cover
Information Security Handbook
$ 31.99
$ 10.00
Puppet 5 Beginner's Guide - Third Edition Book Cover
Puppet 5 Beginner's Guide - Third Edition
$ 31.99
$ 10.00
Mastering Sublime Text Book Cover
Mastering Sublime Text
$ 17.99
$ 10.00
AWS Administration - The Definitive Guide - Second Edition Book Cover
AWS Administration - The Definitive Guide - Second Edition
$ 35.99
$ 10.00
Scala Design Patterns - Second Edition Book Cover
Scala Design Patterns - Second Edition
$ 35.99
$ 10.00