Discover how to use Rust to write fast, secure, and concurrent systems and applications
Starting by comparing Rust with other programming languages, this book will show you where and how to use Rust. It will discuss primitive types along with variables and their scope, binding and casting, simple functions, and ways to control execution flow in a program.
Next, the book covers flexible arrays, vectors, tuples, enums, and structs. You will then generalize the code with higher-order functions and generics applying it to closures, iterators, consumers, and so on. Memory safety is ensured by the compiler by using references, pointers, boxes, reference counting, and atomic reference counting. You will learn how to build macros and crates and discover concurrency for multicore execution.
By the end of this book, you will have successfully migrated to using Rust and will be able to use it as your main programming language.
What You Will Learn
Set up your Rust environment for maximum productivity
Bridge the performance gap between safe and unsafe languages with Rust
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 threads to tackle problems concurrently and in distributed environments
Interface with C and isolate unsafe code
Downloading the example code for this book. You can download the example code files for all Packt books you have purchased 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 e-mailed directly to you.