Idiomatic Rust: Code Like a Rustacean

Matthews, Brenden

  • 出版商: Manning
  • 出版日期: 2024-10-08
  • 售價: $2,280
  • 貴賓價: 9.5$2,166
  • 語言: 英文
  • 頁數: 256
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1633437469
  • ISBN-13: 9781633437463
  • 相關分類: Rust 語言
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

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.

Purchase of the print book includes a free eBook in PDF and ePub formats from Manning Publications

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

商品描述(中文翻譯)

提示、技巧、設計模式以及 Rust 的秘密功能,將幫助您構建穩定且可維護的應用程式。

無論您是 Rust 的初學者還是專業人士,《Idiomatic Rust》都將教您成為更好的 Rust 程式設計師。這本書介紹了 Rust 軟體的基本設計模式,並提供詳細的解釋和鼓勵您深入實作的程式碼範例。

在《Idiomatic Rust》中,您將學習如何應用重要的設計模式,包括:

- 創建令人愉悅的 API 的流暢介面
- 封裝數據並執行初始化的 Builder 模式
- 幫助您避免難以調試的數據競爭條件的不可變數據結構
- 函數式程式設計模式
- 反模式以及在 Rust 中不應該做的事情

《Idiomatic Rust》編目、記錄並描述了經典設計模式如何與 Rust 一起運作,以及幫助您掌握這門語言的新 Rust 特定模式。每個模式或最佳實踐都有助於解決常見的程式設計問題,並確保您的程式碼易於他人理解。您將學習何時使用每個模式——以及何時打破它!您將很快能夠產出更高品質的 Rust 程式碼和更高品質的 Rust 軟體。

購買印刷版書籍可獲得 Manning Publications 提供的免費 PDF 和 ePub 格式電子書。

關於技術

在您熟悉 Rust 的語法及其獨特強大的編譯器後,還有一個全新的維度等待您在實際專案中探索。如何在 Rust 應用程式中應用標準設計模式?您應該在何處以及為什麼使用 IntoIterator?為什麼 Rustaceans 喜愛 PhantomData 類型?這本書將回答這些問題以及更多。

關於這本書

《Idiomatic Rust》介紹了您需要利用 Rust 獨特語言設計的編碼和設計模式。這本書清晰的解釋和可重用的程式碼範例幫助您探索元程式設計,構建自己的庫,創建流暢的介面等等。在這個過程中,您將學習如何編寫高效、符合慣用法的 Rust 程式碼,並隨著您了解語言的底層運作,讓程式碼易於維護和演進。

內容概覽

- 創建令人愉悅的 API
- 應用 Builder 和其他經典設計模式
- 函數式程式設計模式
- Rust 反模式

關於讀者

適合中階 Rust 程式設計師。

關於作者

Brenden Matthews 是 Apache Software Foundation 的成員,系統監控工具 Conky 的創建者,以及《Code Like a Pro in Rust》的作者。

本書的技術編輯是 Alain M Couniot。

目錄

第一部分
1 Rust 的模式
2 Rust 的基本構建塊
3 程式碼流程

第二部分
4 入門模式
5 設計模式:超越基礎
6 設計一個庫

第三部分
7 使用 traits、generics 和 structs 進行專門任務
8 狀態機、協程、宏和前導

第四部分
9 不可變性
10 反模式
A 安裝 Rust

作者簡介

Brenden Matthews is a software engineer, entrepreneur, and a prolific open source contributor. He has been using Rust since the early days of the language, and has contributed to a number of Rust tools and OS projects.

作者簡介(中文翻譯)

Brenden Matthews 是一位軟體工程師、企業家以及多產的開源貢獻者。他自語言早期便開始使用 Rust,並對多個 Rust 工具和作業系統專案做出了貢獻。