Close Modal

Rust for Rustaceans

Idiomatic Programming for Experienced Developers

Look inside
Paperback
$49.99 US
7"W x 9.25"H x 0.64"D   (17.8 x 23.5 x 1.6 cm) | 19 oz (527 g) | 26 per carton
On sale Dec 21, 2021 | 280 Pages | 9781718501850
Sales rights: World

Master professional-level coding in Rust.

For developers who’ve mastered the basics, this book is the next step on your way to professional-level programming in Rust. It covers everything you need to build and maintain larger code bases, write powerful and flexible applications and libraries, and confidently expand the scope and complexity of your projects.
 
Author Jon Gjengset takes you deep into the Rust programming language, dissecting core topics like ownership, traits, concurrency, and unsafe code. You’ll explore key concepts like type layout and trait coherence, delve into the inner workings of concurrent programming and asynchrony with async/await, and take a tour of the world of no_std programming. Gjengset also provides expert guidance on API design, testing strategies, and error handling, and will help develop your understanding of foreign function interfaces, object safety, procedural macros, and much more.
 
You'll Learn:
  • How to design reliable, idiomatic, and ergonomic Rust programs based on best principles
  • Effective use of declarative and procedural macros, and the difference between them
  • How asynchrony works in Rust – all the way from the Pin and Waker types used in manual implementations of Futures, to how async/await saves you from thinking about most of those words
  • What it means for code to be unsafe, and best practices for writing and interacting with unsafe functions and traits
  • How to organize and configure more complex Rust projects so that they integrate nicely with the rest of the ecosystem
  • How to write Rust code that can interoperate with non-Rust libraries and systems, or run in constrained and embedded environments
  •  
    Brimming with practical, pragmatic insights that you can immediately apply, Rust for Rustaceans helps you do more with Rust, while also teaching you its underlying mechanisms.
    "You'll learn dozens—probably hundreds—of things about how to improve your Rust programming by reading this book."
    —Tim McNamara, author of Rust in Action

    "One of Rust's weaknesses as a language is there's a lot of beginner content and a lot of advanced content, but any intermediate content is just nonexistent or requires quite the struggle to learn. Jon Gjengset has done a wonderful job of distilling those next steps into an easy to read book."
    —Michael Gattozzi, Senior Software Engineer, Fastly

    "For a long time, people have asked me what they should read after The Rust Programming Language. Rust for Rustaceans is that book. This book will teach you how to effectively *use* Rust, after you've understood the core syntax and semantics of the language itself. Rust has a rich number of tools for you to choose from, and Rust for Rustaceans will show them all off, and teach you how to properly take advantage of all the richness Rust has to offer."
    —Steve Klabnik, co-author of The Rust Programming Language

    "Rust for Rustaceans is such a good book (for folks who already know rust)!"
    —Ron Bowes, @iagox86
    Jon Gjengset has worked in the Rust ecosystem since the early days of Rust 1.0, and built a high-performance relational database from scratch in Rust over the course of his PhD at MIT. He’s been a frequent contributor to the Rust toolchain and ecosystem, including the asynchronous runtime tokio, and maintains several popular Rust crates, such as hdrhistogram and inferno. Jon has been teaching Rust since 2018, when he started live-streaming intermediate-level Rust programming. Since then, he’s made videos that cover advanced topics like async and await, pinning, variance, atomics, dynamic dispatch, and more, which have been received enthusiastically by the Rust community.
     
    David Tolnay, who reviewed the book’s technical content, is a prolific, well-known, and respected contributor in the Rust ecosystem who maintains some of the most widely used Rust libraries, including syn, serde, and anyhow. He is also a member of the Rust library team.
    Available for sale exclusive:
    •     Afghanistan
    •     Aland Islands
    •     Albania
    •     Algeria
    •     Andorra
    •     Angola
    •     Anguilla
    •     Antarctica
    •     Antigua/Barbuda
    •     Argentina
    •     Armenia
    •     Aruba
    •     Australia
    •     Austria
    •     Azerbaijan
    •     Bahamas
    •     Bahrain
    •     Bangladesh
    •     Barbados
    •     Belarus
    •     Belgium
    •     Belize
    •     Benin
    •     Bermuda
    •     Bhutan
    •     Bolivia
    •     Bonaire, Saba
    •     Bosnia Herzeg.
    •     Botswana
    •     Bouvet Island
    •     Brazil
    •     Brit.Ind.Oc.Ter
    •     Brit.Virgin Is.
    •     Brunei
    •     Bulgaria
    •     Burkina Faso
    •     Burundi
    •     Cambodia
    •     Cameroon
    •     Canada
    •     Cape Verde
    •     Cayman Islands
    •     Centr.Afr.Rep.
    •     Chad
    •     Chile
    •     China
    •     Christmas Islnd
    •     Cocos Islands
    •     Colombia
    •     Comoro Is.
    •     Congo
    •     Cook Islands
    •     Costa Rica
    •     Croatia
    •     Cuba
    •     Curacao
    •     Cyprus
    •     Czech Republic
    •     Dem. Rep. Congo
    •     Denmark
    •     Djibouti
    •     Dominica
    •     Dominican Rep.
    •     Ecuador
    •     Egypt
    •     El Salvador
    •     Equatorial Gui.
    •     Eritrea
    •     Estonia
    •     Ethiopia
    •     Falkland Islnds
    •     Faroe Islands
    •     Fiji
    •     Finland
    •     France
    •     Fren.Polynesia
    •     French Guinea
    •     Gabon
    •     Gambia
    •     Georgia
    •     Germany
    •     Ghana
    •     Gibraltar
    •     Greece
    •     Greenland
    •     Grenada
    •     Guadeloupe
    •     Guam
    •     Guatemala
    •     Guernsey
    •     Guinea Republic
    •     Guinea-Bissau
    •     Guyana
    •     Haiti
    •     Heard/McDon.Isl
    •     Honduras
    •     Hong Kong
    •     Hungary
    •     Iceland
    •     India
    •     Indonesia
    •     Iran
    •     Iraq
    •     Ireland
    •     Isle of Man
    •     Israel
    •     Italy
    •     Ivory Coast
    •     Jamaica
    •     Japan
    •     Jersey
    •     Jordan
    •     Kazakhstan
    •     Kenya
    •     Kiribati
    •     Kuwait
    •     Kyrgyzstan
    •     Laos
    •     Latvia
    •     Lebanon
    •     Lesotho
    •     Liberia
    •     Libya
    •     Liechtenstein
    •     Lithuania
    •     Luxembourg
    •     Macau
    •     Macedonia
    •     Madagascar
    •     Malawi
    •     Malaysia
    •     Maldives
    •     Mali
    •     Malta
    •     Marshall island
    •     Martinique
    •     Mauritania
    •     Mauritius
    •     Mayotte
    •     Mexico
    •     Micronesia
    •     Minor Outl.Ins.
    •     Moldavia
    •     Monaco
    •     Mongolia
    •     Montenegro
    •     Montserrat
    •     Morocco
    •     Mozambique
    •     Myanmar
    •     Namibia
    •     Nauru
    •     Nepal
    •     Netherlands
    •     New Caledonia
    •     New Zealand
    •     Nicaragua
    •     Niger
    •     Nigeria
    •     Niue
    •     Norfolk Island
    •     North Korea
    •     North Mariana
    •     Norway
    •     Oman
    •     Pakistan
    •     Palau
    •     Palestinian Ter
    •     Panama
    •     PapuaNewGuinea
    •     Paraguay
    •     Peru
    •     Philippines
    •     Pitcairn Islnds
    •     Poland
    •     Portugal
    •     Puerto Rico
    •     Qatar
    •     Reunion Island
    •     Romania
    •     Russian Fed.
    •     Rwanda
    •     S. Sandwich Ins
    •     Saint Martin
    •     Samoa,American
    •     San Marino
    •     SaoTome Princip
    •     Saudi Arabia
    •     Senegal
    •     Serbia
    •     Seychelles
    •     Sierra Leone
    •     Singapore
    •     Sint Maarten
    •     Slovakia
    •     Slovenia
    •     Solomon Islands
    •     Somalia
    •     South Africa
    •     South Korea
    •     South Sudan
    •     Spain
    •     Sri Lanka
    •     St Barthelemy
    •     St. Helena
    •     St. Lucia
    •     St. Vincent
    •     St.Chr.,Nevis
    •     St.Pier,Miquel.
    •     Sth Terr. Franc
    •     Sudan
    •     Suriname
    •     Svalbard
    •     Swaziland
    •     Sweden
    •     Switzerland
    •     Syria
    •     Tadschikistan
    •     Taiwan
    •     Tanzania
    •     Thailand
    •     Timor-Leste
    •     Togo
    •     Tokelau Islands
    •     Tonga
    •     Trinidad,Tobago
    •     Tunisia
    •     Turkey
    •     Turkmenistan
    •     Turks&Caicos Is
    •     Tuvalu
    •     US Virgin Is.
    •     USA
    •     Uganda
    •     Ukraine
    •     Unit.Arab Emir.
    •     United Kingdom
    •     Uruguay
    •     Uzbekistan
    •     Vanuatu
    •     Vatican City
    •     Venezuela
    •     Vietnam
    •     Wallis,Futuna
    •     West Saharan
    •     Western Samoa
    •     Yemen
    •     Zambia
    •     Zimbabwe

    Chapter 1: Rust Programming Mindset
    Chapter 2: Foundations
    Chapter 3: Types and Traits
    Chapter 4: Designing Interfaces
    Chapter 5: Error Handling
    Chapter 6: Project Structure
    Chapter 7: Testing
    Chapter 8: Macros
    Chapter 9: Asynchronous Programming
    Chapter 10: Unsafe Rust
    Chapter 11: Concurrency
    Chapter 12: Foreign Function Interface
    Chapter 13: no_std
    Chapter 14: Interacting with Large Projects
    Chapter 15: Putting It Together
    Index

    About

    Master professional-level coding in Rust.

    For developers who’ve mastered the basics, this book is the next step on your way to professional-level programming in Rust. It covers everything you need to build and maintain larger code bases, write powerful and flexible applications and libraries, and confidently expand the scope and complexity of your projects.
     
    Author Jon Gjengset takes you deep into the Rust programming language, dissecting core topics like ownership, traits, concurrency, and unsafe code. You’ll explore key concepts like type layout and trait coherence, delve into the inner workings of concurrent programming and asynchrony with async/await, and take a tour of the world of no_std programming. Gjengset also provides expert guidance on API design, testing strategies, and error handling, and will help develop your understanding of foreign function interfaces, object safety, procedural macros, and much more.
     
    You'll Learn:
  • How to design reliable, idiomatic, and ergonomic Rust programs based on best principles
  • Effective use of declarative and procedural macros, and the difference between them
  • How asynchrony works in Rust – all the way from the Pin and Waker types used in manual implementations of Futures, to how async/await saves you from thinking about most of those words
  • What it means for code to be unsafe, and best practices for writing and interacting with unsafe functions and traits
  • How to organize and configure more complex Rust projects so that they integrate nicely with the rest of the ecosystem
  • How to write Rust code that can interoperate with non-Rust libraries and systems, or run in constrained and embedded environments
  •  
    Brimming with practical, pragmatic insights that you can immediately apply, Rust for Rustaceans helps you do more with Rust, while also teaching you its underlying mechanisms.

    Praise

    "You'll learn dozens—probably hundreds—of things about how to improve your Rust programming by reading this book."
    —Tim McNamara, author of Rust in Action

    "One of Rust's weaknesses as a language is there's a lot of beginner content and a lot of advanced content, but any intermediate content is just nonexistent or requires quite the struggle to learn. Jon Gjengset has done a wonderful job of distilling those next steps into an easy to read book."
    —Michael Gattozzi, Senior Software Engineer, Fastly

    "For a long time, people have asked me what they should read after The Rust Programming Language. Rust for Rustaceans is that book. This book will teach you how to effectively *use* Rust, after you've understood the core syntax and semantics of the language itself. Rust has a rich number of tools for you to choose from, and Rust for Rustaceans will show them all off, and teach you how to properly take advantage of all the richness Rust has to offer."
    —Steve Klabnik, co-author of The Rust Programming Language

    "Rust for Rustaceans is such a good book (for folks who already know rust)!"
    —Ron Bowes, @iagox86

    Author

    Jon Gjengset has worked in the Rust ecosystem since the early days of Rust 1.0, and built a high-performance relational database from scratch in Rust over the course of his PhD at MIT. He’s been a frequent contributor to the Rust toolchain and ecosystem, including the asynchronous runtime tokio, and maintains several popular Rust crates, such as hdrhistogram and inferno. Jon has been teaching Rust since 2018, when he started live-streaming intermediate-level Rust programming. Since then, he’s made videos that cover advanced topics like async and await, pinning, variance, atomics, dynamic dispatch, and more, which have been received enthusiastically by the Rust community.
     
    David Tolnay, who reviewed the book’s technical content, is a prolific, well-known, and respected contributor in the Rust ecosystem who maintains some of the most widely used Rust libraries, including syn, serde, and anyhow. He is also a member of the Rust library team.

    Rights

    Available for sale exclusive:
    •     Afghanistan
    •     Aland Islands
    •     Albania
    •     Algeria
    •     Andorra
    •     Angola
    •     Anguilla
    •     Antarctica
    •     Antigua/Barbuda
    •     Argentina
    •     Armenia
    •     Aruba
    •     Australia
    •     Austria
    •     Azerbaijan
    •     Bahamas
    •     Bahrain
    •     Bangladesh
    •     Barbados
    •     Belarus
    •     Belgium
    •     Belize
    •     Benin
    •     Bermuda
    •     Bhutan
    •     Bolivia
    •     Bonaire, Saba
    •     Bosnia Herzeg.
    •     Botswana
    •     Bouvet Island
    •     Brazil
    •     Brit.Ind.Oc.Ter
    •     Brit.Virgin Is.
    •     Brunei
    •     Bulgaria
    •     Burkina Faso
    •     Burundi
    •     Cambodia
    •     Cameroon
    •     Canada
    •     Cape Verde
    •     Cayman Islands
    •     Centr.Afr.Rep.
    •     Chad
    •     Chile
    •     China
    •     Christmas Islnd
    •     Cocos Islands
    •     Colombia
    •     Comoro Is.
    •     Congo
    •     Cook Islands
    •     Costa Rica
    •     Croatia
    •     Cuba
    •     Curacao
    •     Cyprus
    •     Czech Republic
    •     Dem. Rep. Congo
    •     Denmark
    •     Djibouti
    •     Dominica
    •     Dominican Rep.
    •     Ecuador
    •     Egypt
    •     El Salvador
    •     Equatorial Gui.
    •     Eritrea
    •     Estonia
    •     Ethiopia
    •     Falkland Islnds
    •     Faroe Islands
    •     Fiji
    •     Finland
    •     France
    •     Fren.Polynesia
    •     French Guinea
    •     Gabon
    •     Gambia
    •     Georgia
    •     Germany
    •     Ghana
    •     Gibraltar
    •     Greece
    •     Greenland
    •     Grenada
    •     Guadeloupe
    •     Guam
    •     Guatemala
    •     Guernsey
    •     Guinea Republic
    •     Guinea-Bissau
    •     Guyana
    •     Haiti
    •     Heard/McDon.Isl
    •     Honduras
    •     Hong Kong
    •     Hungary
    •     Iceland
    •     India
    •     Indonesia
    •     Iran
    •     Iraq
    •     Ireland
    •     Isle of Man
    •     Israel
    •     Italy
    •     Ivory Coast
    •     Jamaica
    •     Japan
    •     Jersey
    •     Jordan
    •     Kazakhstan
    •     Kenya
    •     Kiribati
    •     Kuwait
    •     Kyrgyzstan
    •     Laos
    •     Latvia
    •     Lebanon
    •     Lesotho
    •     Liberia
    •     Libya
    •     Liechtenstein
    •     Lithuania
    •     Luxembourg
    •     Macau
    •     Macedonia
    •     Madagascar
    •     Malawi
    •     Malaysia
    •     Maldives
    •     Mali
    •     Malta
    •     Marshall island
    •     Martinique
    •     Mauritania
    •     Mauritius
    •     Mayotte
    •     Mexico
    •     Micronesia
    •     Minor Outl.Ins.
    •     Moldavia
    •     Monaco
    •     Mongolia
    •     Montenegro
    •     Montserrat
    •     Morocco
    •     Mozambique
    •     Myanmar
    •     Namibia
    •     Nauru
    •     Nepal
    •     Netherlands
    •     New Caledonia
    •     New Zealand
    •     Nicaragua
    •     Niger
    •     Nigeria
    •     Niue
    •     Norfolk Island
    •     North Korea
    •     North Mariana
    •     Norway
    •     Oman
    •     Pakistan
    •     Palau
    •     Palestinian Ter
    •     Panama
    •     PapuaNewGuinea
    •     Paraguay
    •     Peru
    •     Philippines
    •     Pitcairn Islnds
    •     Poland
    •     Portugal
    •     Puerto Rico
    •     Qatar
    •     Reunion Island
    •     Romania
    •     Russian Fed.
    •     Rwanda
    •     S. Sandwich Ins
    •     Saint Martin
    •     Samoa,American
    •     San Marino
    •     SaoTome Princip
    •     Saudi Arabia
    •     Senegal
    •     Serbia
    •     Seychelles
    •     Sierra Leone
    •     Singapore
    •     Sint Maarten
    •     Slovakia
    •     Slovenia
    •     Solomon Islands
    •     Somalia
    •     South Africa
    •     South Korea
    •     South Sudan
    •     Spain
    •     Sri Lanka
    •     St Barthelemy
    •     St. Helena
    •     St. Lucia
    •     St. Vincent
    •     St.Chr.,Nevis
    •     St.Pier,Miquel.
    •     Sth Terr. Franc
    •     Sudan
    •     Suriname
    •     Svalbard
    •     Swaziland
    •     Sweden
    •     Switzerland
    •     Syria
    •     Tadschikistan
    •     Taiwan
    •     Tanzania
    •     Thailand
    •     Timor-Leste
    •     Togo
    •     Tokelau Islands
    •     Tonga
    •     Trinidad,Tobago
    •     Tunisia
    •     Turkey
    •     Turkmenistan
    •     Turks&Caicos Is
    •     Tuvalu
    •     US Virgin Is.
    •     USA
    •     Uganda
    •     Ukraine
    •     Unit.Arab Emir.
    •     United Kingdom
    •     Uruguay
    •     Uzbekistan
    •     Vanuatu
    •     Vatican City
    •     Venezuela
    •     Vietnam
    •     Wallis,Futuna
    •     West Saharan
    •     Western Samoa
    •     Yemen
    •     Zambia
    •     Zimbabwe

    Table of Contents

    Chapter 1: Rust Programming Mindset
    Chapter 2: Foundations
    Chapter 3: Types and Traits
    Chapter 4: Designing Interfaces
    Chapter 5: Error Handling
    Chapter 6: Project Structure
    Chapter 7: Testing
    Chapter 8: Macros
    Chapter 9: Asynchronous Programming
    Chapter 10: Unsafe Rust
    Chapter 11: Concurrency
    Chapter 12: Foreign Function Interface
    Chapter 13: no_std
    Chapter 14: Interacting with Large Projects
    Chapter 15: Putting It Together
    Index