Zero To Production In Rust
Subtitle: An Opinionated Introduction to Backend Development
Publisher: Independently Published
Published: 2022-03-14
Language: eng
Format: Paperback
ISBN-13: 9798847211437
First sentence: When you read these lines, Rust has achieved its biggest goal: make an offer to programmers to write their production systems in a different language.
Table of contents: title: Foreword
pagenum: xiii; title: Preface
pagenum: xv; title: What Is This Book About
pagenum: xv; title: Cloud-native applications
pagenum: xv; title: Working in a team
pagenum: xvi; title: Who Is This Book For
pagenum: xvii; label: 1
title: Getting Started
pagenum: 1; label: 1.1
title: Installing The Rust Toolchain
pagenum: 1; label: 1.1.1
title: Compilation Targets
pagenum: 1; label: 1.1.2
title: Release Channels
pagenum: 2; label: 1.1.3
title: What Toolchains Do We Need?
pagenum: 2; label: 1.2
title: Project Setup
pagenum: 3; label: 1.3
title: IDEs
pagenum: 3; label: 1.3.1
title: Rust-analyzer
pagenum: 4; label: 1.3.2
title: IntelliJ Rust
pagenum: 4; label: 1.3.3
title: What Should I Use?
pagenum: 4; label: 1.4
title: Inner Development Loop
pagenum: 4; label: 1.4.1
title: Faster Linking
pagenum: 5; label: 1.4.2
title: cargo-watch
pagenum: 6; label: 1.5
title: Continuous Integration
pagenum: 6; label: 1.5.1
title: CI Steps
pagenum: 7; label: 1.5.2
title: Ready-to-go CI Pipelines
pagenum: 10; label: 2
title: Building An Email Newsletter
pagenum: 11; label: 2.1
title: Our Driving Example
pagenum: 11; label: 2.1.1
title: Problem-based Learning
pagenum: 11; label: 2.2
title: What Should Our Newsletter Do?
pagenum: 12; label: 2.2.1
title: Capturing Requirements: User Stories
pagenum: 12; label: 2.3
title: Working In Iterations
pagenum: 13; label: 2.3.1
title: Coming Up
pagenum: 13; label: 2.4
title: Checking Your Progress
pagenum: 14; label: 3
title: Sign Up A New Subscriber
pagenum: 15; label: 3.1
title: Our Strategy
pagenum: 15; label: 3.2
title: Choosing A Web Framework
pagenum: 16; label: 3.3
title: Our First Endpoint: A Basic Health Check
pagenum: 16; label: 3.3.1
title: Wiring up actix-web
pagenum: 16; label: 3.3.2
title: Anatomy Of An actix-web Application
pagenum: 18; label: 3.3.3
title: Implementing The Health Check Handler
pagenum: 23; label: 3.4
title: Our First Integration Test
pagenum: 25; label: 3.4.1
title: How Do You Test An Endpoint?
pagenum: 25; label: 3.4.2
title: Where Should I Put My Tests?
pagenum: 27; label: 3.4.3
title: Changing Our Project Structure For Easier Testing
pagenum: 28; label: 3.5
title: Implementing Our First Integration Test
pagenum: 31; label: 3.5.1
title: Polishing
pagenum: 35; label: 3.6
title: Refocus
pagenum: 38; label: 3.7
title: Working With HTML Forms
pagenum: 39; label: 3.7.1
title: Refining Our Requirements
pagenum: 39; label: 3.7.2
title: Capturing Our Requirements As Tests
pagenum: 40; label: 3.7.3
title: Parsing Form Data From A POST Request
pagenum: 42; label: 3.8
title: Storing Data: Databases
pagenum: 50; label: 3.8.1
title: Choosing A Database
pagenum: 51; label: 3.8.2
title: Choosing A Database Crate
pagenum: 52; label: 3.8.3
title: Integration Testing With Side-effects
pagenum: 54; label: 3.8.4
title: Database Setup
pagenum: 55; label: 3.8.5
title: Writing Our First Query
pagenum: 61; label: 3.9
title: Persisting A New Subscriber
pagenum: 69; label: 3.9.1
title: Application State In actix-web
pagenum: 69; label: 3.9.2
title: actix-web Workers
pagenum: 71; label: 3.9.3
title: The Data Extractor
pagenum: 73; label: 3.9.4
title: The INSERT Query
pagenum: 74; label: 3.10
title: Updating Our Tests
pagenum: 78; label: 3.10.1
title: Test Isolation
pagenum: 81; label: 3.11
title: Summary
pagenum: 85; label: 4
title: Telemetry
pagenum: 86; label: 4.1
title: Unknown Unknowns
pagenum: 86; label: 4.2
title: Observability
pagenum: 87; label: 4.3
title: Logging
pagenum: 88; label: 4.3.1
title: The log Crate
pagenum: 88; label: 4.3.2
title: actix-web's Logger Middleware
pagenum: 89; label: 4.3.3
title: The Facade Pattern
pagenum: 90; label: 4.4
title: Instrumenting POST /subscriptions
pagenum: 92; label: 4.4.1
title: Interactions With External Systems
pagenum: 93; label: 4.4.2
title: Think Like A User
pagenum: 94; label: 4.4.3
title: Logs Must Be Easy To Correlate
pagenum: 96; label: 4.5
title: Structured Logging
pagenum: 98; label: 4.5.1
title: The tracing Crate
pagenum: 99; label: 4.5.2
title: Migrating from log To tracing
pagenum: 99; label: 4.5.3
title: tracing's Span
pagenum: 100; label: 4.5.4
title: Instrumenting Futures
pagenum: 103; label: 4.5.5
title: tracing's Subscriber
pagenum: 104; label: 4.5.6
title: tracing-subscriber
pagenum: 105; label: 4.5.7
title: tracing-bunyan-formatter
pagenum: 106; label: 4.5.8
title: tracing-log
pagenum: 108; label: 4.5.9
title: Removing Unused Dependencies
pagenum: 109; label: 4.5.10
title: Cleaning Up Initialisation
pagenum: 110; label: 4.5.11
title: Logs For Integration Tests
pagenum: 113; label: 4.5.12
title: Cleaning Up Instrumentation Code - tracing::instrument
pagenum: 117; label: 4.5.13
title: Protect Your Secrets - secrecy
pagenum: 121; label: 4.5.14
title: Request Id
pagenum: 124; label: 4.5.15
title: Leveraging The tracing Ecosystem
pagenum: 126; label: 4.6
title: Summary
pagenum: 127; label: 5
title: Going Live
pagenum: 128; label: 5.1
title: We Must Talk About Deployments
pagenum: 128; label: 5.2
title: Choosing Our Tools
pagenum: 129; label: 5.2.1
title: Virtualisation: Docker
pagenum: 129; label: 5.2.2
title: Hosting: DigitalOcean
pagenum: 130; label: 5.3
title: A Dockerfile For Our Application
pagenum: 130; label: 5.3.1
title: Dockerfiles
pagenum: 130; label: 5.3.2
title: Build Context
pagenum: 131; label: 5.3.3
title: Sqlx Offline Mode
pagenum: 132; label: 5.3.4
title: Running An Image
pagenum: 134; label: 5.3.5
title: Networking
pagenum: 135; label: 5.3.6
title: Hierarchical Configuration
pagenum: 136; label: 5.3.7
title: Database Connectivity
pagenum: 141; label: 5.3.8
title: Optimising Our Docker Image
pagenum: 142; label: 5.4
title: Deploy To DigitalOcean Apps Platform
pagenum: 147; label: 5.4.1
title: Setup
pagenum: 147; label: 5.4.2
title: App Specification
pagenum: 147; label: 5.4.3
title: How To Inject Secrets Using Environment Variables
pagenum: 150; label: 5.4.4
title: Connecting To Digital Ocean’s Postgres Instance
pagenum: 152; label: 5.4.5
title: Environment Variables In The App Spec
pagenum: 156; label: 5.4.6
title: One Last Push
pagenum: 156; label: 6
title: Reject Invalid Subscribers #1
pagenum: 158; label: 6.1
title: Requirements
pagenum: 159; label: 6.1.1
title: Domain Constraints
pagenum: 159; label: 6.1.2
title: Security Constraints
pagenum: 159; label: 6.2
title: First Implementation
pagenum: 160; label: 6.3
title: Validation Is A Leaky Cauldron
pagenum: 163; label: 6.4
title: Type-Driven Development
pagenum: 163; label: 6.5
title: Ownership Meets Invariants
pagenum: 167; label: 6.5.1
title: AsRef
pagenum: 170; label: 6.6
title: Panics
pagenum: 172; label: 6.7
title: Error As Values - Result
pagenum: 174; label: 6.7.1
title: Converting parse To Return Result
pagenum: 175; label: 6.8
title: Insightful Assertion Errors: claims
pagenum: 178; label: 6.9
title: Unit Tests
pagenum: 179; label: 6.10
title: Handling A Result
pagenum: 181; label: 6.10.1
title: match
pagenum: 181; label: 6.10.2
title: The ? Operator
pagenum: 182; label: 6.10.3
title: 400 Bad Request
pagenum: 183; label: 6.11
title: The Email Format
pagenum: 183; label: 6.12
title: The SubscriberEmail Type
pagenum: 184; label: 6.12.1
title: Breaking The Domain Sub-Module
pagenum: 184; label: 6.12.2
title: Skeleton Of A New Type
pagenum: 186; label: 6.13
title: Property-based Testing
pagenum: 188; label: 6.13.1
title: How To Generate Random Test Data With fake
pagenum: 188; label: 6.13.2
title: quickcheck Vs proptest
pagenum: 189; label: 6.13.3
title: Getting Started With quickcheck
pagenum: 190; label: 6.13.4
title: Implementing The Arbitrary Trait
pagenum: 191; label: 6.14
title: Payload Validation
pagenum: 193; label: 6.14.1
title: Refactoring With TryFrom
pagenum: 197; label: 6.15
title: Summary
pagenum: 199; label: 7
title: Reject Invalid Subscribers #2
pagenum: 201; label: 7.1
title: Confirmation Emails
pagenum: 201; label: 7.1.1
title: Subscriber Consent
pagenum: 201; label: 7.1.2
title: The Confirmation User Journey
pagenum: 202; label: 7.1.3
title: The Implementation Strategy
pagenum: 202; label: 7.2
title: EmailClient, Our Email Delivery Component
pagenum: 203; label: 7.2.1
title: How To Send An Email
pagenum: 203; label: 7.2.2
title: How To Write A REST Client Using reqwest
pagenum: 206; label: 7.2.3
title: How To Test A REST Client
pagenum: 214; label: 7.2.4
title: First Sketch Of EmailClient::send_email
pagenum: 219; label: 7.2.5
title: Tightening Our Happy Path Test
pagenum: 227; label: 7.2.6
title: Dealing With Failures
pagenum: 234; label: 7.3
title: Skeleton And Principles For A Maintainable Test Suite
pagenum: 244; label: 7.3.1
title: Why Do We Write Tests?
pagenum: 244; label: 7.3.2
title: Why Don’t We Write Tests?
pagenum: 245; label: 7.3.3
title: Test Code Is Still Code
pagenum: 245; label: 7.3.4
title: Our Test Suite
pagenum: 246; label: 7.3.5
title: Test Discovery
pagenum: 247; label: 7.3.6
title: One Test File, One Crate
pagenum: 247; label: 7.3.7
title: Sharing Test Helpers
pagenum: 248; label: 7.3.8
title: Sharing Startup Logic
pagenum: 251; label: 7.3.9
title: Build An API Client
pagenum: 260; label: 7.3.10
title: Summary
pagenum: 264; label: 7.4
title: Refocus
pagenum: 264; label: 7.5
title: Zero Downtime Deployments
pagenum: 265; label: 7.5.1
title: Reliability
pagenum: 265; label: 7.5.2
title: Deployment Strategies
pagenum: 265; label: 7.6
title: Database Migrations
pagenum: 268; label: 7.6.1
title: State Is Kept Outside The Application
pagenum: 268; label: 7.6.2
title: Deployments And Migrations
pagenum: 269; label: 7.6.3
title: Multi-step Migrations
pagenum: 269; label: 7.6.4
title: A New Mandatory Column
pagenum: 270; label: 7.6.5
title: A New Table
pagenum: 271; label: 7.7
title: Sending A Confirmation Email
pagenum: 272; label: 7.7.1
title: A Static Email
pagenum: 272; label: 7.7.2
title: A Static Confirmation Link
pagenum: 277; label: 7.7.3
title: Pending Confirmation
pagenum: 281; label: 7.7.4
title: Skeleton of GET /subscriptions/confirm
pagenum: 284; label: 7.7.5
title: Connecting The Dots
pagenum: 287; label: 7.7.6
title: Subscription Tokens
pagenum: 296; label: 7.8
title: Database Transactions
pagenum: 304; label: 7.8.1
title: All Or Nothing
pagenum: 304; label: 7.8.2
title: Transactions In Postgres
pagenum: 305; label: 7.8.3
title: Transactions In Sqlx
pagenum: 305; label: 7.9
title: Summary
pagenum: 309; label: 8
title: Error Handling
pagenum: 311; label: 8.1
title: What Is The Purpose Of Errors?
pagenum: 311; label: 8.1.1
title: Internal Errors
pagenum: 312; label: 8.1.2
title: Errors At The Edge
pagenum: 314; label: 8.1.3
title: Summary
pagenum: 316; label: 8.2
title: Error Reporting For Operators
pagenum: 317; label: 8.2.1
title: Keeping Track Of The Error Root Cause
pagenum: 319; label: 8.2.2
title: The Error Trait
pagenum: 324; label: 8.3
title: Errors For Control Flow
pagenum: 328; label: 8.3.1
title: Layering
pagenum: 328; label: 8.3.2
title: Modelling Errors as Enums
pagenum: 329; label: 8.3.3
title: The Error Type Is Not Enough
pagenum: 331; label: 8.3.4
title: Removing The Boilerplate With thiserror
pagenum: 335; label: 8.4
title: Avoid “Ball Of Mud” Error Enums
pagenum: 337; label: 8.4.1
title: Using anyhow As Opaque Error Type
pagenum: 342; label: 8.4.2
title: anyhow Or thiserror?
pagenum: 344; label: 8.5
title: Who Should Log Errors?
pagenum: 345; label: 8.6
title: Summary
pagenum: 346; label: 9
title: Naive Newsletter Delivery
pagenum: 348; label: 9.1
title: User Stories Are Not Set In Stone
pagenum: 348; label: 9.2
title: Do Not Spam Unconfirmed Subscribers
pagenum: 349; label: 9.2.1
title: Set Up State Using The Public API
pagenum: 351; label: 9.2.2
title: Scoped Mocks
pagenum: 351; label: 9.2.3
title: Green Test
pagenum: 352; label: 9.3
title: All Confirmed Subscribers Receive New Issues
pagenum: 353; label: 9.3.1
title: Composing Test Helpers
pagenum: 353; label: 9.4
title: Implementation Strategy
pagenum: 355; label: 9.5
title: Body Schema
pagenum: 355; label: 9.5.1
title: Test Invalid Inputs
pagenum: 356; label: 9.6
title: Fetch Confirmed Subscribers List
pagenum: 358; label: 9.7
title: Send Newsletter Emails
pagenum: 361; label: 9.7.1
title: context Vs with_context
pagenum: 362; label: 9.8
title: Validation Of Stored Data
pagenum: 363; label: 9.8.1
title: Responsibility Boundaries
pagenum: 366; label: 9.8.2
title: Follow The Compiler
pagenum: 368; label: 9.8.3
title: Remove Some Boilerplate
pagenum: 370; label: 9.9
title: Limitations Of The Naive Approach
pagenum: 371; label: 9.10
title: Summary
pagenum: 372; label: 10
title: Securing Our API
pagenum: 373; label: 10.1
title: Authentication
pagenum: 373; label: 10.1.1
title: Drawbacks
pagenum: 374; label: 10.1.2
title: Multi-factor Authentication
pagenum: 374; label: 10.2
title: Password-based Authentication
pagenum: 374; label: 10.2.1
title: Basic Authentication
pagenum: 374; label: 10.2.2
title: Password Verification - Naive Approach
pagenum: 380; label: 10.2.3
title: Password Storage
pagenum: 383; label: 10.2.4
title: Do Not Block The Async Executor
pagenum: 400; label: 10.2.5
title: User Enumeration
pagenum: 407; label: 10.3
title: Is it safe?
pagenum: 412; label: 10.3.1
title: Transport Layer Security (TLS)
pagenum: 412; label: 10.3.2
title: Password Reset
pagenum: 412; label: 10.3.3
title: Interaction Types
pagenum: 412; label: 10.3.4
title: Machine To Machine
pagenum: 412; label: 10.3.5
title: Person Via Browser
pagenum: 413; label: 10.3.6
title: Machine to machine, on behalf of a person
pagenum: 414; label: 10.4
title: Interlude: Next Steps
pagenum: 414; label: 10.5
title: Login Forms
pagenum: 415; label: 10.5.1
title: Serving HTML Pages
pagenum: 415; label: 10.6
title: Login
pagenum: 417; label: 10.6.1
title: HTML Forms
pagenum: 418; label: 10.6.2
title: Redirect On Success
pagenum: 421; label: 10.6.3
title: Processing Form Data
pagenum: 421; label: 10.6.4
title: Contextual Errors
pagenum: 430; label: 10.7
title: Sessions
pagenum: 462; label: 10.7.1
title: Session-based Authentication
pagenum: 462; label: 10.7.2
title: Session Store
pagenum: 462; label: 10.7.3
title: Choosing A Session Store
pagenum: 463; label: 10.7.4
title: actix-session
pagenum: 464; label: 10.7.5
title: Admin Dashboard
pagenum: 467; label: 10.8
title: Seed Users
pagenum: 479; label: 10.8.1
title: Database Migration
pagenum: 479; label: 10.8.2
title: Password Reset
pagenum: 480; label: 10.9
title: Refactoring
pagenum: 497; label: 10.9.1
title: How To Write An actix-web Middleware
pagenum: 498; label: 10.10
title: Summary
pagenum: 505; label: 11
title: Fault-tolerant Workflows
pagenum: 507; label: 11.1
title: POST /admin/newsletters - A Refresher
pagenum: 507; label: 11.2
title: Our Goal
pagenum: 509; label: 11.3
title: Failure Modes
pagenum: 509; label: 11.3.1
title: Invalid Inputs
pagenum: 509; label: 11.3.2
title: Network I/O
pagenum: 510; label: 11.3.3
title: Application Crashes
pagenum: 511; label: 11.3.4
title: Author Actions
pagenum: 511; label: 11.4
title: Idempotency: An Introduction
pagenum: 511; label: 11.4.1
title: Idempotency In Action: Payments
pagenum: 512; label: 11.4.2
title: Idempotency Keys
pagenum: 513; label: 11.4.3
title: Concurrent Requests
pagenum: 513; label: 11.5
title: Requirements As Tests #1
pagenum: 514; label: 11.6
title: Implementation Strategies
pagenum: 515; label: 11.6.1
title: Stateful Idempotency: Save And Replay
pagenum: 515; label: 11.6.2
title: Stateless Idempotency: Deterministic Key Generation
pagenum: 516; label: 11.6.3
title: Time Is a Tricky Beast
pagenum: 516; label: 11.6.4
title: Making A Choice
pagenum: 516; label: 11.7
title: Idempotency Store
pagenum: 517; label: 11.7.1
title: Which Database Should We Use?
pagenum: 517; label: 11.7.2
title: Schema
pagenum: 517; label: 11.8
title: Save And Replay
pagenum: 519; label: 11.8.1
title: Read Idempotency Key
pagenum: 519; label: 11.8.2
title: Retrieve Saved Responses
pagenum: 523; label: 11.8.3
title: Save Responses
pagenum: 526; label: 11.9
title: Concurrent Requests
pagenum: 533; label: 11.9.1
title: Requirements As Tests #2
pagenum: 533; label: 11.9.2
title: Synchronization
pagenum: 535; label: 11.10
title: Dealing With Errors
pagenum: 542; label: 11.10.1
title: Distributed Transactions
pagenum: 544; label: 11.10.2
title: Backward Recovery
pagenum: 544; label: 11.10.3
title: Forward Recovery
pagenum: 545; label: 11.10.4
title: Asynchronous Processing
pagenum: 545; label: 11.11
title: Epilogue
pagenum: 562; title: Links reference
pagenum: 564