use slab instead of reinventing the wheel (#112)

This commit is contained in:
Ferdinand Schober
2024-04-26 00:10:04 +02:00
committed by GitHub
parent 279e582698
commit 3e96b42067
14 changed files with 83 additions and 115 deletions

View File

@@ -90,15 +90,13 @@ pub fn run() -> Result<()> {
log::info!("client {handle} deactivated");
}
}
FrontendEvent::Created(client) => {
let handle = client.handle;
FrontendEvent::Created(handle, client) => {
let port = client.port;
let pos = client.pos;
let hostname = client.hostname.as_deref().unwrap_or("");
log::info!("new client ({handle}): {hostname}:{port} - {pos}");
}
FrontendEvent::Updated(client) => {
let handle = client.handle;
FrontendEvent::Updated(handle, client) => {
let port = client.port;
let pos = client.pos;
let hostname = client.hostname.as_deref().unwrap_or("");
@@ -111,10 +109,10 @@ pub fn run() -> Result<()> {
log::warn!("{e}");
}
FrontendEvent::Enumerate(clients) => {
for (client, active) in clients.into_iter() {
for (handle, client, active) in clients.into_iter() {
log::info!(
"client ({}) [{}]: active: {}, associated addresses: [{}]",
client.handle,
handle,
client.hostname.as_deref().unwrap_or(""),
if active { "yes" } else { "no" },
client