cleaner implmentation for hashmap additions

This commit is contained in:
Mitchell 2020-06-30 14:21:00 +01:00
parent 5eb3adbe8a
commit 35d391eb8a
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
use crate::server::client::client_profile::Client;
//use crate::client_management::client_profile::Client;
use std::sync::Mutex;
use std::sync::Arc;
use std::collections::HashMap;
use dashmap::DashMap;
pub fn add_client(clients_ref: &Arc<Mutex<HashMap<String, Client>>>, client: &Client){
let mut clients_hashmap = clients_ref.lock().unwrap();
let uuid = client.get_uuid().to_string();
clients_hashmap.insert(uuid, client.clone());
}