This commit is contained in:
griffi-gh 2023-02-06 02:40:45 +01:00
parent 102bc101e0
commit 324dc5d43e
2 changed files with 8 additions and 2 deletions

View file

@ -3,7 +3,7 @@ use std::{
net::{UdpSocket, SocketAddr},
time::{Instant, Duration},
marker::PhantomData,
collections::{VecDeque, vec_deque::Drain},
collections::VecDeque,
};
use bincode::{Encode, Decode};
use crate::{
@ -169,7 +169,7 @@ impl<S, R> Client<S, R> where S: Encode + Decode, R: Encode + Decode {
pub fn get_event(&mut self) -> Option<ClientEvent<R>> {
self.event_queue.pop_front()
}
pub fn process_events(&mut self) -> Drain<ClientEvent<R>> {
pub fn process_events(&mut self) -> impl Iterator<Item = ClientEvent<R>> + '_ {
self.event_queue.drain(..)
}
}

View file

@ -23,4 +23,10 @@ impl Server {
clients: HashMap::with_capacity_and_hasher(MAX_CLIENTS, BuildNoHashHasher::default())
})
}
pub fn update(&mut self) {
let mut buf = Vec::new();
if self.socket.recv(&mut buf).is_ok() {
todo!()
}
}
}