1
0
Fork 0
mirror of https://github.com/tokio-rs/axum.git synced 2025-04-26 13:56:22 +02:00

Add information about the meaning of Router<S> to Router documentation ()

This commit is contained in:
Wojciech Kordalski 2025-02-27 22:55:14 +01:00 committed by GitHub
parent 7724967867
commit 2a5189ed63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,6 +58,12 @@ macro_rules! panic_on_err {
pub(crate) struct RouteId(u32);
/// The router type for composing handlers and services.
///
/// `Router<S>` 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<S = ()> {
inner: Arc<RouterInner<S>>,