From 398bc79a3f1f4316e6cc33b6e6bce133c1db3e4c Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Mon, 27 Oct 2025 17:29:36 -0400 Subject: Convert the `Conversations` component into a freestanding struct. Unlike the previous example, this involves cloning an event broadcaster, as well. This is, per the documentation, how the type may be used. From : > The Sender can be cloned to send to the same channel from multiple points in the process or it can be used concurrently from an `Arc`. The language is less firm than the language sqlx uses for its pool, but the intent is clear enough, and it works in practice. --- src/ui/handlers/conversation.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/ui/handlers/conversation.rs') diff --git a/src/ui/handlers/conversation.rs b/src/ui/handlers/conversation.rs index f1bb319..2ff090c 100644 --- a/src/ui/handlers/conversation.rs +++ b/src/ui/handlers/conversation.rs @@ -4,8 +4,7 @@ use axum::{ }; use crate::{ - app::App, - conversation::{self, app}, + conversation::{self, app, app::Conversations}, error::Internal, token::extract::Identity, ui::{ @@ -15,12 +14,12 @@ use crate::{ }; pub async fn handler( - State(app): State, + State(conversations): State, identity: Option, Path(conversation): Path, ) -> Result { let _ = identity.ok_or(Error::NotLoggedIn)?; - app.conversations() + conversations .get(&conversation) .await .map_err(Error::from)?; -- cgit v1.2.3