once_cell -> std
This commit is contained in:
parent
a41a84fd2d
commit
90387c5a3b
28 changed files with 157 additions and 153 deletions
|
@ -1,15 +1,17 @@
|
|||
use std::collections::HashMap;
|
||||
use std::{collections::HashMap, sync::OnceLock};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use poise::serenity_prelude::Color;
|
||||
|
||||
pub static COLORS: Lazy<HashMap<&str, Color>> = Lazy::new(|| {
|
||||
HashMap::from([
|
||||
("red", Color::from((239, 68, 68))),
|
||||
("green", Color::from((34, 197, 94))),
|
||||
("blue", Color::from((96, 165, 250))),
|
||||
("yellow", Color::from((253, 224, 71))),
|
||||
("orange", Color::from((251, 146, 60))),
|
||||
// TODO purple & pink :D
|
||||
])
|
||||
});
|
||||
pub fn colors() -> &'static HashMap<&'static str, Color> {
|
||||
static COLORS: OnceLock<HashMap<&str, Color>> = OnceLock::new();
|
||||
COLORS.get_or_init(|| {
|
||||
HashMap::from([
|
||||
("red", Color::from((239, 68, 68))),
|
||||
("green", Color::from((34, 197, 94))),
|
||||
("blue", Color::from((96, 165, 250))),
|
||||
("yellow", Color::from((253, 224, 71))),
|
||||
("orange", Color::from((251, 146, 60))),
|
||||
// TODO purple & pink :D
|
||||
])
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue