Книги и журналы » Компьютерная литература » Программирование (книги)
Rust EssentialsГод издания: 2015
Автор: Ivo Balbaert
Издательство: Packt Publishing
ISBN: 9781785285769
Язык: Английский
Формат: ePub
Качество: Изначально компьютерное (eBook)
Интерактивное оглавление: Да
Количество страниц: 205
Описание: 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.
[spoiler="Примеры страниц"]

[/spoiler]
[spoiler="Оглавление"]
1:
Starting with RustThe advantages of Rust
The trifecta of Rust – safety, speed, and concurrency
Using Rust
Installing Rust
The Rust compiler – rustc
Our first program
Working with Cargo
The developer tools
Summary
2:
Using Variables and TypesComments
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
3:
Using Functions and Control StructuresBranching on a condition
Looping
Functions
Attributes
Testing
Summary
4:
Structuring Data and Matching PatternsStrings
Arrays, vectors, and slices
Tuples
Structs
Enums
Getting input from the console
Matching patterns
Summary
5:
Generalizing Code with Higher-order Functions and ParametrizationHigher-order functions and closures
Iterators
Consumers and adapters
Generic data structures and functions
Error handling
Methods on structs
Traits
Using trait constraints
Built-in traits and operator overloading
Summary
6:
Pointers and Memory SafetyPointers and references
Ownership and borrowing
Boxes
Reference counting
An overview of pointers
Summary
7:
Organizing Code and MacrosModules and crates
Macros
Summary
8:
Concurrency and ParallelismConcurrency and threads
The shared mutable state
Communication through channels
Summary
9:
Programming at the BoundariesProgram arguments
Unsafe code
Raw pointers
Interfacing with C
Calling Rust from other languages
Summary
[/spoiler]