From fd876efa68a8b568a5cb01fe3628919967a60764 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 26 Apr 2018 09:05:07 -0700 Subject: [PATCH] allow to access application state during configuration stage --- src/application.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/application.rs b/src/application.rs index 268b10af..68aa4a57 100644 --- a/src/application.rs +++ b/src/application.rs @@ -200,6 +200,12 @@ where } } + /// Get reference to the application state + pub fn state(&self) -> &S { + let parts = self.parts.as_ref().expect("Use after finish"); + &parts.state + } + /// Set application prefix. /// /// Only requests that match the application's prefix get