Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Rust Web Programming

You're reading from   Rust Web Programming A hands-on guide to Rust for modern web development, with microservices and nanoservices

Arrow left icon
Product type Paperback
Published in Nov 2025
Last Updated in Sep 2025
Publisher Packt
ISBN-13 9781835887769
Length 733 pages
Edition 3rd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Maxwell Flitton Maxwell Flitton
Author Profile Icon Maxwell Flitton
Maxwell Flitton
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Rust Web Programming, Third Edition: A hands-on guide to Rust for modern web development, with microservices and nanoservices FREE CHAPTER
1 A Quick Introduction to Rust 2 Useful Rust Patterns for Web Programming 3 Designing Your Web Application in Rust 4 Async Rust 5 Handling HTTP Requests 6 Processing HTTP Requests 7 Displaying Content in the Browser 8 Injecting Rust in the Frontend with WASM 9 Data Persistence with PostgreSQL 10 Managing user sessions 11 Communicating Between Servers 12 Caching auth sessions 13 Observability through logging

Answers

  1. A GET request can be cached, and there are limits to the types and amount of data that can be sent. A POST request has a body, which enables more data to be transferred. Also, it cannot be cached.
  2. We use middleware to open the header and check the credentials before sending the request to the desired view. This gives us an opportunity to prevent the body being loaded by returning an auth error before loading the view, preventing the potentially malicious body.
  3. For the struct to be directly returned, we will have to implement the Responder trait. During this implementation, we will have to define the responded_to function that accepts the HTTP request struct. The responded_to will be fired when the struct is returned.
  4. To enact middleware we can implement the FromRequest trait for a struct, and then pass that struct as a parameter in the function of the API endpoint
  5. We decorate the struct with the #[derive(Deserialize)] macro. Once we have done this, we define the parameter type...
lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Rust Web Programming
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon