diff options
| author | Jomar Milan <jomarm@jomarm.com> | 2026-06-22 19:45:08 -0700 |
|---|---|---|
| committer | Jomar Milan <jomarm@jomarm.com> | 2026-06-22 19:45:08 -0700 |
| commit | bc7e613204a1dbc2f5b37761a6649658effe2483 (patch) | |
| tree | e086fb6977d79230ddf9f9728c2a77c2819307ec /src/main.rs | |
| parent | 9c50777d53cacb96b211d1afb54f801a88dc07f5 (diff) | |
Move crate::play to crate::app::socket
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 38bbbf2..a4e51c1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,20 +7,20 @@ #![warn(missing_docs, missing_debug_implementations)] mod app; -mod play; mod session; mod template; use crate::app::AppState; -use crate::play::handle_play; use crate::session::{HandObject, PlayerColor}; use crate::template::{IndexTemplate, SessionTemplate}; +use app::socket::handle_play; use askama::Template; use axum::extract::{Path, Query, State, WebSocketUpgrade}; use axum::http::{StatusCode, header}; use axum::response::{ErrorResponse, Html, IntoResponse, Redirect, Response}; use axum::routing::{any, get, put}; use axum::{Json, Router}; +use futures_util::StreamExt; use rust_embed::Embed; use std::array; use std::collections::HashMap; @@ -132,5 +132,8 @@ async fn update_hands( } async fn upgrade_play(ws: WebSocketUpgrade, State(state): State<Arc<AppState>>) -> Response { - ws.on_upgrade(|socket| handle_play(socket, state)) + ws.on_upgrade(|socket| { + let (sender, receiver) = socket.split(); + handle_play(sender, receiver, state) + }) } |
