From 2a5189ed634622c97f23c9ec1f974bafc0b74c1d Mon Sep 17 00:00:00 2001 From: Wojciech Kordalski Date: Thu, 27 Feb 2025 22:55:14 +0100 Subject: [PATCH] Add information about the meaning of `Router` to `Router` documentation (#3235) --- axum/src/routing/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/axum/src/routing/mod.rs b/axum/src/routing/mod.rs index 2e975d99..9c30288e 100644 --- a/axum/src/routing/mod.rs +++ b/axum/src/routing/mod.rs @@ -58,6 +58,12 @@ macro_rules! panic_on_err { pub(crate) struct RouteId(u32); /// The router type for composing handlers and services. +/// +/// `Router` means a router that is _missing_ a state of type `S` to be able +/// to handle requests. Thus, only `Router<()>` (i.e. without missing state) can +/// be passed to [`serve`]. See [`Router::with_state`] for more details. +/// +/// [`serve`]: crate::serve() #[must_use] pub struct Router { inner: Arc>,