Muutke küpsiste eelistusi

E-raamat: Beginning Rust: Get Started with Rust 2021 Edition

  • Formaat: PDF+DRM
  • Ilmumisaeg: 01-Jan-2022
  • Kirjastus: APress
  • Keel: eng
  • ISBN-13: 9781484272084
  • Formaat - PDF+DRM
  • Hind: 67,91 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Lisa ostukorvi
  • Lisa soovinimekirja
  • See e-raamat on mõeldud ainult isiklikuks kasutamiseks. E-raamatuid ei saa tagastada.
  • Formaat: PDF+DRM
  • Ilmumisaeg: 01-Jan-2022
  • Kirjastus: APress
  • Keel: eng
  • ISBN-13: 9781484272084

DRM piirangud

  • Kopeerimine (copy/paste):

    ei ole lubatud

  • Printimine:

    ei ole lubatud

  • Kasutamine:

    Digitaalõiguste kaitse (DRM)
    Kirjastus on väljastanud selle e-raamatu krüpteeritud kujul, mis tähendab, et selle lugemiseks peate installeerima spetsiaalse tarkvara. Samuti peate looma endale  Adobe ID Rohkem infot siin. E-raamatut saab lugeda 1 kasutaja ning alla laadida kuni 6'de seadmesse (kõik autoriseeritud sama Adobe ID-ga).

    Vajalik tarkvara
    Mobiilsetes seadmetes (telefon või tahvelarvuti) lugemiseks peate installeerima selle tasuta rakenduse: PocketBook Reader (iOS / Android)

    PC või Mac seadmes lugemiseks peate installima Adobe Digital Editionsi (Seeon tasuta rakendus spetsiaalselt e-raamatute lugemiseks. Seda ei tohi segamini ajada Adober Reader'iga, mis tõenäoliselt on juba teie arvutisse installeeritud )

    Seda e-raamatut ei saa lugeda Amazon Kindle's. 

Learn to program with Rust 2021 Edition, in an easy, step-by-step manner on Unix, the Linux shell, macOS, and the Windows command line.  As you read this book, youll build on the knowledge you gained in previous chapters and see what Rust has to offer.   





Beginning Rust starts with the basics of Rust, including how to name objects, control execution flow, and handle primitive types. Youll see how to do arithmetic, allocate memory, use iterators, and handle input/output. Once you have mastered these core skills, youll work on handling errors and using the object-oriented features of Rust to build robust Rust applications in no time.





Only a basic knowledge of programming in C or C++ and familiarity with a command console are required. After reading this book, youll be ready to build simple Rust applications.





What You Will Learn









Get started programming with Rust Understand heterogeneous data structures and data sequences Define functions, generic functions, structs, and more Work with closures, changeable strings, ranges and slices Use traits and learn about lifetimes  

Who This Book Is For 





Those who are new to Rust and who have at least some prior experience with programming in general: some C/C++ is recommended particularly.
About the Author xv
About the Technical Reviewer xvii
Preface xix
Chapter 1 Getting Started 1(8)
How to Start
1(1)
Hello, World!
2(2)
Printing Combinations of Literal Strings
4(1)
Printing Several Lines of Text
5(1)
Printing Integer Numbers
6(1)
Comments
7(2)
Chapter 2 Doing Arithmetic and Writing More Code 9(8)
Adding Integer Numbers
9(1)
Other Operations Between Integer Numbers
10(1)
Floating-Point Arithmetic
11(2)
Sequences of Statements
13(1)
Breaking Literal Strings
14(3)
Chapter 3 Naming Objects 17(16)
Associating Names to Values
17(2)
Mutable Variables
19(2)
Not Mutated Mutable Variables
21(1)
Uninitialized Variables
22(2)
The Leading Underscore
24(1)
Boolean Values
25(2)
Boolean Expressions
27(1)
Type Consistency in Assignments
28(1)
Type Inference
29(1)
Change of Type and of Mutability
30(1)
Compound Assignment Operators
31(1)
Using the Functions of the Standard Library
31(2)
Chapter 4 Controlling Execution Flow 33(14)
Conditional Statements (if)
33(3)
Conditional Expressions
36(2)
Conditional Loops (while)
38(2)
Infinite Loops (loop)
40(1)
Counting Loops (for)
41(3)
Variables Scopes
44(3)
Chapter 5 Using Data Sequences 47(18)
Arrays
47(3)
Rust Attributes
50(1)
Panicking
51(2)
Mutable Arrays
53(2)
Arrays of Explicitly Specified Size
55(1)
Multidimensional Arrays
56(1)
Vectors
57(2)
Other Operations on Vectors
59(2)
Empty Arrays and Vectors
61(1)
Debug Print
62(1)
Copying Arrays and Vectors
63(2)
Chapter 6 Using Primitive Types 65(24)
Nondecimal Numeric Bases
66(1)
The Underscore in Numeric Literals
67(1)
The Exponential Notation
67(2)
The Various Kinds of Signed Integer Numbers
69(2)
Unsigned Integer Number Types
71(1)
Target-Dependent Integer-Number Types
72(2)
Type Inference
74(2)
The Type Inference Algorithm
76(1)
Floating-Point Numeric Types
77(1)
Explicit Conversions
78(1)
Type Suffixes of Numeric Literals
79(1)
All the Numeric Types
80(1)
Booleans and Characters
81(3)
The Empty Tuple
84(1)
Array and Vector Types
85(1)
Constants
85(1)
Discovering the Type of an Expression
86(3)
Chapter 7 Enumerations and Matching 89(18)
Enumerations
89(2)
The match Construct
91(3)
Relational Operators and Enums
94(1)
Handling All the Cases
94(2)
Using match with Numbers
96(1)
Enumerations with Data
97(4)
match Statements with Variables in Patterns
101(1)
match Expressions
102(1)
Use of Guards in match Constructs
103(1)
if-let and while-let Constructs
104(3)
Chapter 8 Using Heterogeneous Data Structures 107(8)
The Tuples
107(2)
The Structs
109(3)
The Tuple-Structs
112(1)
Lexical Conventions
113(2)
Chapter 9 Defining Functions 115(20)
Defining and Invoking a Function
115(1)
Functions Defined After Their Use
116(1)
Functions Shadowing Other Functions
117(1)
Passing Arguments to a Function
118(2)
Passing Arguments by Value
120(1)
Returning a Value from a Function
121(1)
Early Exit
122(2)
Returning Several Values
124(1)
How to Change a Variable of the Caller
125(2)
Passing Arguments by Reference
127(3)
Using References
130(1)
Mutability of References
131(4)
Chapter 10 Defining Generic Functions and Types 135(16)
Need of Generic Functions
135(2)
Defining and Using Generic Functions
137(1)
Inferring the Parametric Types
138(1)
Defining and Using Generic Structs
139(2)
Genericity Mechanics
141(2)
Generic Arrays and Vectors
143(1)
Generic Enums
143(1)
The Option<T> Standard Enum
144(2)
The Result<T, E> Standard Enum
146(1)
Enum Standard Utility Functions
147(4)
Chapter 11 Allocating Memory 151(20)
The Various Kinds of Allocation
151(1)
Linear Addressing
152(2)
Static Allocation
154(1)
Stack Allocation
155(6)
Limitations of Stack Allocation
161(3)
Heap Allocation
164(1)
Heap Management
165(1)
The Behavior of Box
166(1)
Similarity with C and C++
167(1)
Boxing and Unboxing
168(2)
Register Allocation
170(1)
Chapter 12 Data Implementation 171(12)
Discovering the Size of Objects
171(1)
The use Directive
172(1)
The Sizes of the Primitive Types
173(1)
The Representation of Primitive Types
174(1)
Location of Bytes in Memory
175(2)
Sizes of Composite Data Types
177(1)
Vector Allocation
178(5)
Chapter 13 Defining Closures 183(8)
The Need for Disposable Functions
183(1)
Capturing the Environment
184(2)
Closures
186(2)
Closure Invocation Syntax
188(3)
Chapter 14 Using Changeable Strings 191(12)
Static Strings
191(3)
Dynamic Strings
194(1)
Implementation of String
195(3)
Creating Dynamic Strings
198(1)
Converting Static Strings to Dynamic Strings
199(1)
Concatenating Strings
200(3)
Chapter 15 Ranges and Slices 203(14)
The Ranges
203(3)
Motivation for Slices
206(1)
The Slices
207(3)
Slicing
210(2)
Out-of-Range Slicing
212(1)
Mutable Slicing
213(1)
Open-Ended Ranges and Slicing
214(1)
Inclusive Ranges
215(2)
Chapter 16 Using Iterators 217(26)
String Characters
217(2)
Scanning a String
219(2)
Using String Iterators in for Loops
221(1)
The Rust Editions
222(1)
Iterators over Vectors, Arrays, and Slices
223(2)
Iterators Generating References
225(1)
Iterations without Mutation
226(1)
Iterations with Mutation
226(2)
Shorthand for Using Iterators in Loops
228(1)
Iterator Generators
229(1)
An Iterator Adapter: filter
229(1)
The map Iterator Adapter
230(1)
The enumerate Iterator Adapter
231(1)
An Iterator Consumer: any
232(2)
The all Iterator Consumer
234(1)
The count Iterator Consumer
235(1)
The sum Iterator Consumer
235(1)
The min and max Iterator Consumers
236(1)
The collect Consumer
237(2)
Iterator Chains
239(2)
Iterators Are "Lazy"
241(2)
Chapter 17 Input/Output and Error Handling 243(20)
Command-Line Arguments
243(1)
Process Return Code
244(1)
Environment Variables
245(1)
Reading from the Console
246(2)
Proper Runtime Error Handling
248(7)
Writing to the Console
255(1)
Converting a Value to a String
256(1)
Converting a String to a Value
256(1)
File Input/Output
257(3)
Processing Text Files
260(3)
Chapter 18 Data Encapsulation 263(14)
The Need for Methods
263(2)
Method Declarations
265(3)
The self and Self Keywords
268(3)
The mod and the pub Keywords
271(4)
The type Keyword
275(2)
Chapter 19 Using Traits 277(32)
The Need for Traits
277(3)
Traits to the Rescue
280(3)
Generic Functions with No Parameter Bounds
283(1)
Scope of Traits
284(2)
Traits with Multiple Methods
286(1)
Generic Parameters with Multiple Bounds
287(2)
Trait Inheritance
289(1)
Adding Methods to External Types
290(2)
Standard Traits: Display and Debug
292(2)
Generic Traits
294(4)
Using Associated Types
298(8)
The lterator Standard Trait
306(3)
Chapter 20 Object-Oriented Programming 309(28)
Peculiarities of Rust Object-Orientation
309(1)
Destructors
310(4)
Operator Overloading
314(7)
Infallible Type Converters
321(2)
Fallible Type Converters
323(2)
Composition Instead of Inheritance
325(3)
Static Dispatch
328(3)
Dynamic Dispatch
331(1)
Implementation of Dynamic-Dispatch References
332(2)
Static vs. Dynamic Dispatch
334(3)
Chapter 21 Standard Library Collections 337(18)
Collections
337(1)
Measuring Execution Time
338(1)
Performing Arbitrary Insertions and Removals
339(3)
Queues
342(4)
Linked Lists
346(1)
Binary Heaps
346(2)
Ordered Sets and Unordered Sets
348(4)
Ordered Dictionaries and Unordered Dictionaries
352(1)
Collections in C++ and in Rust
353(2)
Chapter 22 Ownership, Moves, and Copies 355(18)
Deterministic Destruction
355(3)
Ownership
358(1)
Assignment Semantics
359(3)
Copying vs. Moving Performance
362(1)
Moving and Destroying Objects
362(3)
Need for Copy Semantics
365(1)
Cloning Objects
366(3)
Making Types Cloneable or Copyable
369(4)
Chapter 23 Borrowing and Lifetimes 373(22)
Programming Errors when Using References
373(4)
Borrowing
377(1)
Object Lifetimes
378(1)
How to Prevent Use After Drop Errors
379(1)
How to Prevent Use After Change by an Alias Errors
380(2)
The Need for Lifetime Specifiers in Returned References
382(3)
Usage and Meaning of Lifetime Specifiers
385(3)
Checking the Validity of Lifetime Specifiers
388(4)
Using the Lifetime Specifiers of Invoked Functions
392(1)
Advantage of Using Several Lifetime Specifiers for a Function
393(2)
Chapter 24 More About Lifetimes 395(12)
Lifetime Elision
395(2)
Lifetime Elision with Object-Oriented Programming
397(1)
The Need for Lifetime Specifiers in Structs Declarations
398(3)
Possible Lifetime Specifiers for Structs
401(3)
Lifetime Specifiers for Tuple-Structs and Enums
404(1)
Lifetime Specifiers for Mutable References
404(3)
Index 407
Carlo Milanesi is a professional software developer and expert who uses Rust. He has contributed to the Rust development community, and also has done web application development in Linux with PHP, JavaScript, Java, and the Ionic and Vaadin frameworks. Lastly, he has been in involved in these other technologies: GUI design, 2D and 3D rendering, testing automation, and database access. Carlo's applications include CAM/CAM for the stone machining industry, lens cutting laboratory automation, and corporate-wide web applications.