feat: intial commit

This commit is contained in:
Nova
2022-05-11 23:50:46 -04:00
commit a75fa63d6a
9 changed files with 900 additions and 0 deletions

21
src/core/eventloop.rs Normal file
View File

@@ -0,0 +1,21 @@
use libstardustxr::fusion::client::Client;
use libstardustxr::server;
use mio::net::UnixListener;
use slab::Slab;
pub struct EventLoop<'a> {
pub socket_path: String,
listener: UnixListener,
clients: Slab<Client<'a>>,
}
impl<'a> EventLoop<'a> {
pub fn new() -> Option<Self> {
let socket_path = server::get_free_socket_path()?;
Some(EventLoop {
listener: UnixListener::bind(socket_path.clone()).ok()?,
socket_path,
clients: Slab::new(),
})
}
}