forked from FreakU/watch-party
use once_cell
This commit is contained in:
parent
337fbba312
commit
aaf2ab3634
|
@ -1100,7 +1100,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"lazy_static",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -12,5 +12,4 @@ serde_json = "1.0.68"
|
||||||
tokio = { version = "1.12.0", features = ["full"] }
|
tokio = { version = "1.12.0", features = ["full"] }
|
||||||
tokio-stream = { version = "0.1.7", features = ["fs"] }
|
tokio-stream = { version = "0.1.7", features = ["fs"] }
|
||||||
warp = "0.3.1"
|
warp = "0.3.1"
|
||||||
lazy_static = "1.4.0"
|
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use rand::prelude::SliceRandom;
|
use rand::prelude::SliceRandom;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const PLURALNOUN: [&'static str; 2847] = [
|
const PLURALNOUN: [&'static str; 2847] = [
|
||||||
"Abilities",
|
"Abilities",
|
||||||
"Absences",
|
"Absences",
|
||||||
|
@ -5626,18 +5625,14 @@ const PATTERNS: [&str; 1] = [
|
||||||
// "_ADJECTIVE__PLURALNOUN_AtThe_PLACE_",
|
// "_ADJECTIVE__PLURALNOUN_AtThe_PLACE_",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
static CATEGORIES: Lazy<HashMap<&'static str, Vec<&'static str>>> = Lazy::new(|| {
|
||||||
|
let mut categories = HashMap::new();
|
||||||
lazy_static! {
|
categories.insert("_PLURALNOUN_", Vec::from(PLURALNOUN));
|
||||||
static ref CATEGORIES: HashMap<&'static str, Vec<&'static str>> = {
|
categories.insert("_VERB_", Vec::from(VERB));
|
||||||
let mut categories = HashMap::new();
|
categories.insert("_ADVERB_", Vec::from(ADVERB));
|
||||||
categories.insert("_PLURALNOUN_", Vec::from(PLURALNOUN));
|
categories.insert("_ADJECTIVE_", Vec::from(ADJECTIVE));
|
||||||
categories.insert("_VERB_", Vec::from(VERB));
|
categories
|
||||||
categories.insert("_ADVERB_", Vec::from(ADVERB));
|
});
|
||||||
categories.insert("_ADJECTIVE_", Vec::from(ADJECTIVE));
|
|
||||||
categories
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// export function generateRoomWithoutSeparator() {
|
// export function generateRoomWithoutSeparator() {
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
#[macro_use]
|
|
||||||
extern crate lazy_static;
|
|
||||||
|
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue