feat: huge refactor to data acessing, some API changes

This commit is contained in:
2026-03-23 14:52:53 -04:00
Unverified
parent c5738741f1
commit 12c5c675e2
6 changed files with 258 additions and 323 deletions

View File

@@ -1,5 +1,3 @@
use std::net::SocketAddr;
use async_trait::async_trait;
use crate::server::Server;
@@ -9,15 +7,14 @@ pub use round_robin::RoundRobin;
#[async_trait]
pub trait Tournament {
fn new(ready_players: &[SocketAddr]) -> Self
fn new(ready_players: &[String]) -> Self
where
Self: Sized;
async fn next(&mut self, server: &Server);
async fn start(&mut self, server: &Server);
async fn cancel(&mut self, server: &Server);
fn inform_winner(&mut self, winner: SocketAddr, is_tie: bool);
fn inform_reconnect(&mut self, old_addr: SocketAddr, new_addr: SocketAddr);
fn contains_player(&self, addr: SocketAddr) -> bool;
fn inform_winner(&mut self, winner: String, is_tie: bool);
fn contains_player(&self, username: String) -> bool;
fn is_completed(&self) -> bool;
fn get_type(&self) -> String;
}