Idiomatic Rust Code like a Rustacean 1st Edition by Brenden Matthews – Ebook PDF Instant Download/DeliveryISBN: 1638355724, 9781638355724
Full download Idiomatic Rust Code like a Rustacean 1st Edition after payment.

Product details:
ISBN-10 : 1638355724
ISBN-13 : 9781638355724
Author: Brenden Matthews
Tips, tricks, design patterns, and secret features of Rust that will help you build stable and maintainable applications. Whether you’re a Rust beginner or a pro, Idiomatic Rust will teach you to be a better Rust programmer. It introduces essential design patterns for Rust software with detailed explanations, and code samples that encourage you to get stuck in. In Idiomatic Rust you’ll learn how to apply important design patterns including: • Fluent interfaces for creating delightful APIs • The Builder pattern to encapsulate data and perform initialization • Immutable data structures that help you avoid hard-to-debug data race conditions • Functional programming patterns • Anti-patterns and what not to do in Rust Idiomatic Rust catalogs, documents, and describes both how classic design patterns work with Rust, and the new Rust-specific patterns that will help you master the language. Each pattern or best practice helps solve common programming problems and ensure your code is easy for others to understand. You’ll learn when to use each pattern—and when to break it! You’ll soon be producing higher-quality Rust code and higher-quality Rust software. About the technology After you’re comfortable with Rust’s syntax and its uniquely-powerful compiler, there’s a whole new dimension to explore as you put it to use in real projects. How do you apply standard design patterns in Rust applications? Where and why should you use IntoIterator? Why do Rustaceans love the PhantomData type? This book answers these questions and many, many more. About the book Idiomatic Rust introduces the coding and design patterns you’ll need to take advantage of Rust’s unique language design. This book’s clear explanations and reusable code examples help you explore metaprogramming, build your own libraries, create fluent interfaces, and more. Along the way, you’ll learn how to write efficient, idiomatic Rust code that’s easy to maintain and evolve as you learn how the language works under the hood. What’s inside • Creating delightful APIs • Applying Builder and other classic design patterns • Functional programming patterns • Rust anti-patterns About the reader For intermediate Rust programmers. About the author Brenden Matthews is a member of the Apache Software Foundation, creator of the system monitor Conky, and author of Code Like a Pro in Rust. The technical editor on this book was Alain M Couniot. Table of Contents PART 1 1 Rust-y patterns 2 Rust’s basic building blocks 3 Code flow PART 2 4 Introductory patterns 5 Design patterns: Beyond the basics 6 Designing a library PART 3 7 Using traits, generics, and structs for specialized tasks 8 State machines, coroutines, macros, and preludes PART 4 9 Immutability 10 Antipatterns A Installing Rust
Idiomatic Rust Code like a Rustacean 1st Table of contents:
Part 1 Building blocks
1 Rust-y patterns
1.1 What this book covers
1.2 What design patterns are
1.3 Why this book is different
1.4 Tools you’ll need
2 Rust’s basic building blocks
2.1 Generics
2.1.1 A Turing-complete type system
2.1.2 Why generics?
2.1.3 Basics of generics
2.1.4 Exploring Rust’s Option
2.1.5 Marker structs and phantom types
2.1.6 Generic parameter trait bounds
2.2 Traits
2.2.1 Why traits are not object-oriented programming
2.2.2 What’s in a trait?
2.2.3 Understanding traits by examining object-oriented code
2.2.4 Combining generics and traits
2.2.5 Deriving traits automatically
2.2.6 Trait objects
3 Code flow
3.1 A tour of pattern matching
3.1.1 Basics of pattern matching
3.1.2 Clean matches with the ? operator
3.2 Functional Rust
3.2.1 Basics of functional programming in Rust
3.2.2 Closure variable capture
3.2.3 Examining iterators
3.2.4 Obtaining an iterator with iter(), into_iter(), and iter_mut()
3.2.5 Iterator features
Part 2 Core patterns
4 Introductory patterns
4.1 Resource acquisition is initialization
4.1.1 Understanding RAII in C and C++
4.1.2 A tour of RAII in Rust
4.1.3 Summarizing RAII in Rust
4.2 Passing arguments by value vs. reference
4.2.1 Passing by value
4.2.2 Passing by reference
4.2.3 When to do what: Passing by value vs. reference
4.3 Constructors
4.4 Object-member visibility and access
4.5 Error handling
4.6 Global state
4.6.1 lazy-static.rs
4.6.2 once_cell
4.6.3 static_init
4.6.4 std::cell::OnceCell
5 Design patterns: Beyond the basics
5.1 Metaprogramming with macros
5.1.1 A basic declarative macro in Rust
5.1.2 When to use macros
5.1.3 Using macros to write mini-DSLs
5.1.4 Using macros for DRY
5.2 Optional function arguments
5.2.1 Examining optional arguments in Python
5.2.2 Examining optional arguments in C++
5.2.3 Optional arguments in Rust or the lack thereof
5.2.4 Emulating optional arguments with traits
5.3 Builder pattern
5.3.1 Implementing the builder pattern
5.3.2 Enhancing our builder with traits
5.3.3 Enhancing our builder with macros
5.4 Fluent interface pattern
5.4.1 A fluent builder
5.4.2 Test-driving our fluent builder
5.5 Observer pattern
5.5.1 Why not callbacks?
5.5.2 Implementing an observer
5.6 Command pattern
5.6.1 Defining the command pattern
5.6.2 Implementing the command pattern
5.7 Newtype pattern
6 Designing a library
6.1 Meditate on good library design
6.2 Do one thing, do it well, and do it correctly
6.3 Avoid excessive abstraction
6.4 Stick to basic types
6.5 Use the tools
6.6 Good artists copy; great artists steal (from the standard library)
6.7 Document everything, and provide examples
6.8 Don’t break the user’s code
6.9 Think of the state
6.10 Consider the aesthetics
6.11 Examining Rust library ergonomics
6.11.1 Revisiting linked lists
6.11.2 Using rustdoc to improve our API design
6.11.3 Improving our linked list with more tests
6.11.4 Making our library easier for others to debug
Part 3 Advanced patterns
7 Using traits, generics, and structs for specialized tasks
7.1 Const generics
7.2 Implementing traits for external crate types
7.2.1 Wrapper structs
7.2.2 Using Deref to unwrap a wrapped struct
7.3 Extension traits
7.4 Blanket traits
7.5 Marker traits
7.6 Struct tagging
7.7 Reference objects
8 State machines, coroutines, macros, and preludes
8.1 Trait state machine
8.2 Coroutines
8.3 Procedural macros
8.4 Preludes
Part 4 Problem avoidance
9 Immutability
9.1 The benefits of immutability
9.2 Why immutability is not a magic bullet
9.3 How to think about immutable data
9.4 Understanding immutability in Rust
9.5 Reviewing the basics of immutability in Rust
9.6 Using traits to make (almost) anything immutable
9.7 Using Cow for immutability
9.8 Using crates for immutable data structures
9.8.1 Using im
9.8.2 Using rpds
10 Antipatterns
10.1 What is an antipattern?
10.2 Using unsafe
10.2.1 What does unsafe do?
10.2.2 Where can you use unsafe?
10.2.3 When should you use unsafe?
10.2.4 Should you worry about unsafe?
10.3 Using unwrap()
10.4 Not using Vec
10.5 Too many clones
10.6 Using Deref to emulate polymorphism
10.7 Global data and singletons
10.8 Too many smart pointers
10.9 Where to go from here
People also search for Idiomatic Rust Code like a Rustacean 1st:
rust idiomatic code
what is idiomatic code
rust code example
idiomatic rust
idiomatic rust meaning
Tags: Idiomatic, Rust Code, Rustacean, Brenden Matthews


