mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-22 14:58:44 -06:00
...
This commit is contained in:
parent
102bc101e0
commit
324dc5d43e
|
@ -3,7 +3,7 @@ use std::{
|
||||||
net::{UdpSocket, SocketAddr},
|
net::{UdpSocket, SocketAddr},
|
||||||
time::{Instant, Duration},
|
time::{Instant, Duration},
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
collections::{VecDeque, vec_deque::Drain},
|
collections::VecDeque,
|
||||||
};
|
};
|
||||||
use bincode::{Encode, Decode};
|
use bincode::{Encode, Decode};
|
||||||
use crate::{
|
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>> {
|
pub fn get_event(&mut self) -> Option<ClientEvent<R>> {
|
||||||
self.event_queue.pop_front()
|
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(..)
|
self.event_queue.drain(..)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,10 @@ impl Server {
|
||||||
clients: HashMap::with_capacity_and_hasher(MAX_CLIENTS, BuildNoHashHasher::default())
|
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!()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue