summaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-10-27 18:15:25 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-10-28 01:43:26 -0400
commitd66728889105f6f1ef5113d9ceb223e362df0008 (patch)
tree5102813fbaa222276dcabd15a736838f9641d71f /src/app.rs
parentc2a3a010c67776b9a459d7ba0930630ff25a3a51 (diff)
Convert the `Setup` component into a freestanding struct.
The changes to the setup-requiring middleware are probably more general than was strictly needed, but they will make it work with anything that can provide a `Setup` component rather than being bolted to `App` specifically, which feels tidier.
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/app.rs b/src/app.rs
index 74e1070..202d542 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -58,8 +58,8 @@ impl App {
Messages::new(self.db.clone(), self.events.clone())
}
- pub const fn setup(&self) -> Setup<'_> {
- Setup::new(&self.db, &self.events)
+ pub fn setup(&self) -> Setup {
+ Setup::new(self.db.clone(), self.events.clone())
}
pub const fn tokens(&self) -> Tokens<'_> {
@@ -101,3 +101,9 @@ impl FromRef<App> for Messages {
app.messages()
}
}
+
+impl FromRef<App> for Setup {
+ fn from_ref(app: &App) -> Self {
+ app.setup()
+ }
+}