mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-24 21:08:19 -06:00
...
This commit is contained in:
parent
9eae5d780b
commit
2e66d0bda8
|
@ -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