Beginning Rust Programming

Beginning Rust Programming

Beginning Rust Programming
Автор: Messier Ric
Дата выхода: 2021
Издательство: John Wiley & Sons, Inc.
Количество страниц: 663
Размер файла: 3.7 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы  Дополнительные материалы 

TITLE PAGE....10

INTRODUCTION....11

OBTAINING RUST....12

GETTING THE SOURCE CODE....14

WHAT YOU WILL LEARN....14

PROVIDING FEEDBACK....19

1 Game of Life: The Basics....20

GAME OF LIFE: THE PROGRAM....21

STARTING WITH CARGO....23

PUTTING THE PIECES TOGETHER....25

GENERATING THE GAME GRID....29

DISSECTING MAIN....30

LOOKING AT MORE FUNCTION FUNCTIONS....43

COMPILING PROGRAMS....53

SUMMARY....56

ADDITIONAL RESOURCES....58

2 Extended Life....60

UNDERSTANDING OWNERSHIP....61

EXTENDING LIFE....64

READING FROM FILES....78

OUTPUTTING TO THE TERMINAL....85

SUMMARY....90

ADDITIONAL RESOURCES....92

3 Building a Library....94

REFERENCES....95

FIRST PASS....100

SECOND PASS....116

SUMMARY....125

ADDITIONAL RESOURCES....127

4 Hangman....128

OUR DATA....133

READING FILES AND SELECTING WORDS....148

THE REST OF THE STORY....157

SUMMARY....164

ADDITIONAL RESOURCES....166

5 In Concurrence....167

THE DINING PHILOSOPHERS....169

THE MAIN EVENT....180

THREADING IN THE MAIN....191

SUMMARY....198

ADDITIONAL RESOURCES....200

6 Clients and Servers....201

PLANNING....203

NETWORK PROGRAMMING....206

RUST TCP SERVER....218

SUMMARY....230

ADDITIONAL RESOURCES....232

7 Client-Side Applications....233

ENCRYPTION....235

REMOTE ACCESS CLIENT....255

SUMMARY....269

ADDITIONAL RESOURCES....271

8 Going Relational....273

APPLICATION ARCHITECTURES....274

DATABASES....283

WRITING A DATABASE PROGRAM....292

SUMMARY....311

ADDITIONAL RESOURCES....314

9 No(SQL) Going....315

ASSERTIONS....316

NOSQL....328

WORKING WITH MONGODB....334

SUMMARY....352

ADDITIONAL RESOURCES....354

10 Web Communications....355

STYLE GUIDES....356

HYPERTEXT TRANSFER PROTOCOL....360

CLIENT COMMUNICATION....378

SUMMARY....391

ADDITIONAL RESOURCES....393

11 Web Server....394

OFFENSIVE VS. DEFENSIVE PROGRAMMING....395

WEB APPLICATION COMMUNICATIONS....399

RUST ROCKET....417

SUMMARY....426

ADDITIONAL RESOURCES....428

12 Getting to the System....430

EXTENDING FUNCTIONALITY....432

WINDOWS REGISTRY....441

SYSTEM INFORMATION WITH RUST....458

PERSISTENCE (FOR FUN)....467

SUMMARY....469

ADDITIONAL RESOURCES....472

13 Device Programming....474

LOGGING....475

WORKING WITH RASPBERRY PI....497

SUMMARY....519

ADDITIONAL RESOURCES....521

14 Collecting Stuff....523

ARRAYS AND VECTORS....524

LINKED LISTS....536

SEARCH TREES....559

SUMMARY....567

ADDITIONAL RESOURCES....569

15 Odds and Sods....571

UNIT TESTING....572

RECURSION....591

MACHINE LEARNING....598

SUMMARY....610

ADDITIONAL RESOURCES....612

INDEX....613

COPYRIGHT....659

ABOUT THE AUTHOR....660

ABOUT THE TECHNICAL EDITOR....661

ACKNOWLEDGMENTS....662

END USER LICENSE AGREEMENT....663

Save me from another “hello, world” book. Don’t make me have to skim or skip through a half dozen chapters before I can get to something that’s going to be useful to me. Or you, in this case. I can’t tell you the number of programming books I’ve purchased over the decades, hoping to actually learn the language, only to end up just not using the book because it wasn’t presented in a way that made a lot of sense to me. Instead of a dry explanation of how the language is constructed so you can try to put it all together in meaningful ways yourself, the purpose of this book is to jump straight into writing hopefully interesting or useful programs. Once we have the program, we can take a look at how it’s constructed. You’ll be learning by doing—or learning by example, if you prefer. I hope you’ll find this a more useful and practical way of learning Rust.

Rust is an interesting language, as it turns out. Like so many other languages, it claims a C-like syntax, which is roughly correct but misses out on many important elements. Where Rust really shines is where C has introduced bad behavior in programming practices. This is more apparent as more have been using C as a language. Where C provides you with the gun and the bullets to shoot yourself in the foot, Rust provides you with necessary protections to keep you from injuring yourself or, from the perspective of the application, keeps the application from crashing. Rust is focused on protecting the memory space of the program, in part to provide a better ability for concurrent programming. After all, Rust is considered to be a systems programming language, meaning it is intended for applications that are lower level than those that a user directly interacts with.

In addition to protections provided to the programmer, Rust has a reasonably active community that can be used not only for support but also to get additional functionality for your programs. There are a lot of third-party libraries. These libraries can make your life easier by introducing you to functionality without you needing to write it yourself.

The idea behind this book is to introduce you to Rust in context, rather than via snippets that, by themselves, don’t work. You need all the surround to fully understand what is happening in the program. You’ll find this out when you are looking at example code sometimes. This is true with the Rust documentation: it’s like you need to fully understand the language to understand the examples you are looking at. This book doesn’t take that approach. It assumes that you don’t know the language, so every line in every program is explained in as much detail as is necessary to pull it all apart, since Rust can be a dense language in some ways. This means single lines can pack a lot of meaning and functionality.

The one thing this book does not assume, though, is that you are coming to programming completely fresh. You will see examples for the programs written in Rust also presented in other programming languages. This may be helpful if you come from another language like C or Python, for instance, but want to learn Rust. Seeing the approach in a language you know before translating it into Rust may be beneficial. If you don’t know those other languages, you can skip through those examples and jump to the explanation of how to write a program for the problem under discussion in Rust. You can still compare the other languages to Rust as you are going through so you can better understand Rust and how it is different from other languages.


Похожее:

Список отзывов:

Нет отзывов к книге.