From a8d5e4f9620e20426f536c92c4a60933ece6493b Mon Sep 17 00:00:00 2001 From: fa-sharp Date: Sun, 16 Nov 2025 13:41:03 -0500 Subject: [PATCH] don't add state to router in init() --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 60105e2..bc12f9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,9 +53,9 @@ where // self // } - /// Build and initialize the server. Returns the base router and a future to run + /// Build and initialize the server. Returns the base router, finalized state, and a future to run /// on graceful shutdown. - pub async fn init(mut self) -> anyhow::Result<(Router, impl Future + Send)> + pub async fn init(mut self) -> anyhow::Result<(Router, S, impl Future + Send)> where S::Error: Display, { @@ -77,7 +77,7 @@ where .filter_map(|mut p| p.on_shutdown(&state)); let on_shutdown = join_all(shutdown_fns); - Ok((router.with_state(state), on_shutdown)) + Ok((router, state, on_shutdown)) } }