From ad67289226e38f150cacedbb6d1a60efcf78c3fe Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 14 Jun 2022 14:10:04 +0200 Subject: [PATCH] Add table of contents to some modules (#1084) --- axum/src/docs/error_handling.md | 7 +++++++ axum/src/docs/extract.md | 15 +++++++++++++++ axum/src/docs/middleware.md | 11 +++++++++++ axum/src/docs/response.md | 5 +++++ 4 files changed, 38 insertions(+) diff --git a/axum/src/docs/error_handling.md b/axum/src/docs/error_handling.md index 3b342121..01a0afaa 100644 --- a/axum/src/docs/error_handling.md +++ b/axum/src/docs/error_handling.md @@ -1,5 +1,12 @@ Error handling model and utilities +# Table of contents + +- [axum's error handling model](#axums-error-handling-model) +- [Routing to fallible services](#routing-to-fallible-services) +- [Applying fallible middleware](#applying-fallible-middleware) +- [Running extractors for error handling](#running-extractors-for-error-handling) + # axum's error handling model axum is based on [`tower::Service`] which bundles errors through its associated diff --git a/axum/src/docs/extract.md b/axum/src/docs/extract.md index 37920923..eedf5ec5 100644 --- a/axum/src/docs/extract.md +++ b/axum/src/docs/extract.md @@ -1,5 +1,20 @@ Types and traits for extracting data from requests. +# Table of contents + +- [Intro](#intro) +- [Common extractors](#common-extractors) +- [Applying multiple extractors](#applying-multiple-extractors) +- [Be careful when extracting `Request`](#be-careful-when-extracting-request) +- [Optional extractors](#optional-extractors) +- [Customizing extractor responses](#customizing-extractor-responses) +- [Accessing inner errors](#accessing-inner-errors) +- [Defining custom extractors](#defining-custom-extractors) +- [Accessing other extractors in `FromRequest` implementations](#accessing-other-extractors-in-fromrequest-implementations) +- [Request body extractors](#request-body-extractors) + +# Intro + A handler function is an async function that takes any number of "extractors" as arguments. An extractor is a type that implements [`FromRequest`](crate::extract::FromRequest). diff --git a/axum/src/docs/middleware.md b/axum/src/docs/middleware.md index 17a3d72f..958c504b 100644 --- a/axum/src/docs/middleware.md +++ b/axum/src/docs/middleware.md @@ -1,3 +1,14 @@ +# Table of contents + +- [Intro](#intro) +- [Applying middleware](#applying-middleware) +- [Commonly used middleware](#commonly-used-middleware) +- [Writing middleware](#writing-middleware) +- [Routing to services/middleware and backpressure](#routing-to-servicesmiddleware-and-backpressure) +- [Sharing state between handlers and middleware](#sharing-state-between-handlers-and-middleware) + +# Intro + axum is unique in that it doesn't have its own bespoke middleware system and instead integrates with [`tower`]. This means the ecosystem of [`tower`] and [`tower-http`] middleware all work with axum. diff --git a/axum/src/docs/response.md b/axum/src/docs/response.md index 09839de5..aebaa9df 100644 --- a/axum/src/docs/response.md +++ b/axum/src/docs/response.md @@ -1,5 +1,10 @@ Types and traits for generating responses. +# Table of contents + +- [Building responses](#building-responses) +- [Returning different response types](#returning-different-response-types) + # Building responses Anything that implements [`IntoResponse`] can be returned from a handler. axum