diff --git a/kubi-udp/src/client.rs b/kubi-udp/src/client.rs index 731dab0..33575ad 100644 --- a/kubi-udp/src/client.rs +++ b/kubi-udp/src/client.rs @@ -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 Client where S: Encode + Decode, R: Encode + Decode { pub fn get_event(&mut self) -> Option> { self.event_queue.pop_front() } - pub fn process_events(&mut self) -> Drain> { + pub fn process_events(&mut self) -> impl Iterator> + '_ { self.event_queue.drain(..) } } diff --git a/kubi-udp/src/server.rs b/kubi-udp/src/server.rs index ff91845..a6a1a1d 100644 --- a/kubi-udp/src/server.rs +++ b/kubi-udp/src/server.rs @@ -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!() + } + } }