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

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); pub(crate) struct RouteId(u32);
/// The router type for composing handlers and services. /// 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] #[must_use]
pub struct Router<S = ()> { pub struct Router<S = ()> {
inner: Arc<RouterInner<S>>, inner: Arc<RouterInner<S>>,