use std::{ collections::HashMap, net::SocketAddr, sync::Arc, }; use tokio::sync::RwLock; use hyper_tungstenite::tungstenite::Message; use hyper::{ Response, Body }; use futures::channel::mpsc::UnboundedSender; use crate::minesweeper; #[derive(Debug, Clone)] pub struct Config { pub cert_path: String, pub pkey_path: String, pub page_path: String, pub socket_addr: SocketAddr, } #[derive(Debug, Clone)] pub struct State { pub conf: Config, pub peers: PeerMap, } #[derive(Debug)] pub enum MetaMove { Move(minesweeper::Move,SocketAddr), Dump, Reset, } #[derive(Debug)] pub struct Peer { pub tx: UnboundedSender, pub seq_id: usize, pub name: String, pub position: (usize, usize), } pub type HtmlResult = Result, Response>; pub type MovReqTx = futures::channel::mpsc::UnboundedSender; pub type PeerMap = Arc>>;