1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00
This commit is contained in:
Rob Ede
2021-10-07 03:04:59 +01:00
parent bfede4c1bb
commit e60e7810de
9 changed files with 18 additions and 18 deletions

View File

@ -2,7 +2,6 @@ use actix::prelude::*;
use actix_broker::BrokerSubscribe;
use std::collections::HashMap;
use std::mem;
use crate::message::{ChatMessage, JoinRoom, LeaveRoom, ListRooms, SendMessage};
@ -17,7 +16,7 @@ pub struct WsChatServer {
impl WsChatServer {
fn take_room(&mut self, room_name: &str) -> Option<Room> {
let room = self.rooms.get_mut(room_name)?;
let room = mem::replace(room, HashMap::new());
let room = std::mem::take(room);
Some(room)
}