chore: move to once_cell from lazy_static

This commit is contained in:
Zomatree
2023-03-12 23:30:01 +00:00
committed by Paul Makles
parent 4c8ea31d98
commit 0321eff62b
21 changed files with 110 additions and 161 deletions

View File

@@ -1,14 +1,14 @@
use std::env;
use serde::{Deserialize, Serialize};
use once_cell::sync::Lazy;
lazy_static! {
pub static ref REGION_ID: u16 = env::var("REGION_ID")
.unwrap_or_else(|_| "0".to_string())
.parse()
.unwrap();
pub static ref REGION_KEY: String = format!("region{}", &*REGION_ID);
}
pub static REGION_ID: Lazy<u16> = Lazy::new(|| env::var("REGION_ID")
.unwrap_or_else(|_| "0".to_string())
.parse()
.unwrap());
pub static REGION_KEY: Lazy<String> = Lazy::new(|| format!("region{}", &*REGION_ID));
/// Compact presence information for a user
#[derive(Serialize, Deserialize, Debug)]