use once_cell

This commit is contained in:
PeachyDelight 2022-06-11 05:15:07 +02:00
parent 337fbba312
commit aaf2ab3634
4 changed files with 9 additions and 19 deletions

1
Cargo.lock generated
View File

@ -1100,7 +1100,6 @@ version = "0.1.0"
dependencies = [
"futures",
"futures-util",
"lazy_static",
"once_cell",
"rand 0.8.5",
"serde",

View File

@ -12,5 +12,4 @@ serde_json = "1.0.68"
tokio = { version = "1.12.0", features = ["full"] }
tokio-stream = { version = "0.1.7", features = ["fs"] }
warp = "0.3.1"
lazy_static = "1.4.0"
rand = "0.8.5"

View File

@ -1,9 +1,8 @@
use std::collections::HashMap;
use once_cell::sync::Lazy;
use rand::prelude::SliceRandom;
const PLURALNOUN: [&'static str; 2847] = [
"Abilities",
"Absences",
@ -5626,18 +5625,14 @@ const PATTERNS: [&str; 1] = [
// "_ADJECTIVE__PLURALNOUN_AtThe_PLACE_",
];
lazy_static! {
static ref CATEGORIES: HashMap<&'static str, Vec<&'static str>> = {
static CATEGORIES: Lazy<HashMap<&'static str, Vec<&'static str>>> = Lazy::new(|| {
let mut categories = HashMap::new();
categories.insert("_PLURALNOUN_", Vec::from(PLURALNOUN));
categories.insert("_VERB_", Vec::from(VERB));
categories.insert("_ADVERB_", Vec::from(ADVERB));
categories.insert("_ADJECTIVE_", Vec::from(ADJECTIVE));
categories
};
}
});
// export function generateRoomWithoutSeparator() {

View File

@ -1,6 +1,3 @@
#[macro_use]
extern crate lazy_static;
use serde_json::json;
use std::net::IpAddr;