1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

chore: fmt

This commit is contained in:
Rob Ede 2023-09-10 20:22:26 +01:00
parent a998ce8ed8
commit a4c0cb22a9
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 5 additions and 17 deletions

View File

@ -1,7 +1,7 @@
//! This example shows how to use `actix_web::HttpServer::on_connect` to access client certificates
//! pass them to a handler through connection-local data.
use std::{any::Any, sync::Arc, fs::File, io::BufReader, net::SocketAddr};
use std::{any::Any, fs::File, io::BufReader, net::SocketAddr, sync::Arc};
use actix_tls::accept::rustls_0_21::{reexports::ServerConfig, TlsStream};
use actix_web::{

View File

@ -128,10 +128,7 @@ impl ChatServer {
self.sessions.insert(id, tx);
// auto join session to main room
self.rooms
.entry("main".to_owned())
.or_default()
.insert(id);
self.rooms.entry("main".to_owned()).or_default().insert(id);
let count = self.visitor_count.fetch_add(1, Ordering::SeqCst);
self.send_system_message("main", 0, format!("Total visitors {count}"))
@ -185,10 +182,7 @@ impl ChatServer {
.await;
}
self.rooms
.entry(room.clone())
.or_default()
.insert(conn_id);
self.rooms.entry(room.clone()).or_default().insert(conn_id);
self.send_system_message(&room, conn_id, "Someone connected")
.await;

View File

@ -129,10 +129,7 @@ impl Handler<Connect> for ChatServer {
self.sessions.insert(id, msg.addr);
// auto join session to main room
self.rooms
.entry("main".to_owned())
.or_default()
.insert(id);
self.rooms.entry("main".to_owned()).or_default().insert(id);
let count = self.visitor_count.fetch_add(1, Ordering::SeqCst);
self.send_message("main", &format!("Total visitors {count}"), 0);
@ -211,10 +208,7 @@ impl Handler<Join> for ChatServer {
self.send_message(&room, "Someone disconnected", 0);
}
self.rooms
.entry(name.clone())
.or_default()
.insert(id);
self.rooms.entry(name.clone()).or_default().insert(id);
self.send_message(&name, "Someone connected", id);
}