diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-10-27 18:26:41 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-10-28 02:08:28 -0400 |
| commit | 9bd5ea4b4292761b0b2f823c887f114459c80d8f (patch) | |
| tree | b90cf7315b9637cb4f0a6620ddc2c2d780f9f016 | |
| parent | be21b088f0d1b591cbd8dcfed1e06f2742a524d0 (diff) | |
Convert the `Users` component into a freestanding struct.
Because `Users` is test-only and is not used in any endpoints, it doesn't need a FromRef impl.
| -rw-r--r-- | src/app.rs | 4 | ||||
| -rw-r--r-- | src/user/app.rs | 12 |
2 files changed, 8 insertions, 8 deletions
@@ -67,8 +67,8 @@ impl App { } #[cfg(test)] - pub const fn users(&self) -> Users<'_> { - Users::new(&self.db, &self.events) + pub fn users(&self) -> Users { + Users::new(self.db.clone(), self.events.clone()) } } diff --git a/src/user/app.rs b/src/user/app.rs index 0d6046c..891e3b9 100644 --- a/src/user/app.rs +++ b/src/user/app.rs @@ -3,13 +3,13 @@ use sqlx::sqlite::SqlitePool; use super::create::{self, Create}; use crate::{clock::DateTime, event::Broadcaster, login::Login, name::Name, password::Password}; -pub struct Users<'a> { - db: &'a SqlitePool, - events: &'a Broadcaster, +pub struct Users { + db: SqlitePool, + events: Broadcaster, } -impl<'a> Users<'a> { - pub const fn new(db: &'a SqlitePool, events: &'a Broadcaster) -> Self { +impl Users { + pub const fn new(db: SqlitePool, events: Broadcaster) -> Self { Self { db, events } } @@ -27,7 +27,7 @@ impl<'a> Users<'a> { tx.commit().await?; let login = stored.login().to_owned(); - stored.publish(self.events); + stored.publish(&self.events); Ok(login) } |
