Good Practices for Writing Rust Libraries
120 pages
English
PDF
4.5

Good Practices for Writing Rust Libraries

Руководство по созданию качественных Rust-библиотек

Author:

Year:

Summary:

Introduction

The book "Good Practices for Writing Rust Libraries" (author — E. Dunham, 2020, 120 pages) is a compact but extremely rich guide dedicated to the art of creating libraries in the Rust language. Unlike many books that teach syntax or language basics, this work focuses specifically on how to make a library convenient, reliable, safe, and easy to use for other developers. Rust is a language known for its strictness and performance, but without proper practices, even in it, you can create inconvenient or unreliable code. This book aims to fill that gap.

What the book is about

The book covers the full lifecycle of a Rust library: from designing the public API to publishing on crates.io and subsequent maintenance. Key topics include:

  • API design principles: minimalism, consistency, backward compatibility.
  • Documenting code with rustdoc: how to write clear examples, descriptions, and warnings.
  • Testing: unit tests, integration tests, doc-tests.
  • Dependency management and versioning (SemVer).
  • Safety: working with unsafe code, safety guarantees, error handling.
  • Performance: profiling, benchmarks, optimization without sacrificing readability.
  • Publishing and maintenance: CI/CD, issue tracking, community communication.

Who this book is for

Recommendations