liveBook · Manning

Rust

As explained in Rust Servers, Services, and Apps

Rust is a statically typed systems programming language designed for memory safety, concurrency, and low-level control without a garbage collector.

Rust is a statically typed language suited to distributed web services that need safety, concurrency, low latency, and a modest hardware-resource footprint. Compile-time type checking catches conflicting types before a program runs. Rust also provides memory safety without a garbage collector and thread safety that prevents race conditions. section 1.2.2 section 1.3.2 section 1.4

The choice is most relevant to backend services and software infrastructure, where throughput, predictable response times, and control of CPU, memory, and network resources matter. Rust can also be used for frontends, but browser-side development is not the focus here. Its costs include a steep learning curve, sometimes difficult syntax, slower compilation than many other compiled languages, and a still-maturing library ecosystem. section 1.2 section 1.2.2 section 1.2.3

Start at the network boundary

Build a TCP client and server with the Rust standard library, then model HTTP requests and responses with structs and enums. An HTTP library parses incoming requests and constructs responses; the server returns static pages or JSON to a browser or curl. Traits add behavior to the protocol types, while lifetime annotations specify how long references in structs remain valid. This server demonstrates the foundations of web services rather than a production-ready implementation. section 2.0 section 2.4

For an application built on those foundations, use Rust across the request flow:

  • Expose RESTful APIs with Actix Web, and use asynchronous I/O for the web-service workload. section 1.3.1
  • Connect to Postgres with SQLx; begin with a single-file program that connects and runs a query. section 1.3.1 section 4.2
  • Keep HTTP handlers, business logic, and database access in separate modules; group related projects with Cargo workspaces and add automated regression tests as the code evolves. section 1.3.2
  • Render a tutor-course storefront on the server, then evolve its data model and migrate the database. Compile-time type checking helps make the associated refactoring safer. section 1.3.1

Rust does not replace application-level design or security work. Password-based authentication and JSON Web Tokens address access to the application; memory and thread safety address different classes of bugs. The application path favors REST over SOAP and includes container deployment with Docker and Docker Compose, while leaving CI/CD outside its scope. section 1.3.2 section 1.3

How Rust Servers, Services, and Apps covers it

How deep it goes
Works from standard-library TCP and HTTP implementations toward asynchronous framework and database code, without making the initial server production-ready.
Examples
Builds a TCP client, an HTTP server serving pages and JSON, and a tutor-course storefront backed by Postgres.
What it assumes
Assumes a web-backend development context while strengthening Rust fundamentals through TCP and HTTP implementations.
What you can do after
Build it from scratch with the Rust standard library, then apply it via Actix Web and SQLx to a database-backed service.
How it connects
Connects Rust to type safety, memory safety, thread safety, TCP, HTTP, asynchronous I/O, REST, and relational databases.

Also explained in

Compare how 6 books explain Rust →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.