termwiz: lazy_static => std::sync::LazyLock
`LazyLock` is a stdlib drop-in replacement to drop the lazy_static dependency.
This commit is contained in:
1 parent
33b40fe629
commit
50ea8c3811
8 files changed
+15
-26
No files matched your search
Generated
-3
@@ -5589,7 +5589,6 @@ dependencies = [
|
||||
"hex",
|
||||
"image",
|
||||
"k9",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"memmem",
|
||||
@@ -6547,7 +6546,6 @@ version = "0.3.0"
|
||||
dependencies = [
|
||||
"csscolorparser",
|
||||
"deltae",
|
||||
"lazy_static",
|
||||
"serde",
|
||||
"wezterm-dynamic",
|
||||
]
|
||||
@@ -6723,7 +6721,6 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"euclid",
|
||||
"lazy_static",
|
||||
"serde",
|
||||
"wezterm-dynamic",
|
||||
]
|
||||
|
||||
@@ -13,6 +13,5 @@ use_serde = ["serde"]
|
||||
[dependencies]
|
||||
csscolorparser = {workspace=true, features=["lab"]}
|
||||
deltae.workspace = true
|
||||
lazy_static.workspace = true
|
||||
serde = {workspace=true, features = ["derive"], optional=true}
|
||||
wezterm-dynamic.workspace = true
|
||||
@@ -4,14 +4,13 @@ use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::str::FromStr;
|
||||
use std::sync::LazyLock;
|
||||
use wezterm_dynamic::{FromDynamic, FromDynamicOptions, ToDynamic, Value};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref SRGB_TO_F32_TABLE: [f32;256] = generate_srgb8_to_linear_f32_table();
|
||||
static ref F32_TO_U8_TABLE: [u32;104] = generate_linear_f32_to_srgb8_table();
|
||||
static ref RGB_TO_SRGB_TABLE: [u8;256] = generate_rgb_to_srgb8_table();
|
||||
static ref RGB_TO_F32_TABLE: [f32;256] = generate_rgb_to_linear_f32_table();
|
||||
}
|
||||
static SRGB_TO_F32_TABLE: LazyLock<[f32; 256]> = LazyLock::new(generate_srgb8_to_linear_f32_table);
|
||||
static F32_TO_U8_TABLE: LazyLock<[u32; 104]> = LazyLock::new(generate_linear_f32_to_srgb8_table);
|
||||
static RGB_TO_SRGB_TABLE: LazyLock<[u8; 256]> = LazyLock::new(generate_rgb_to_srgb8_table);
|
||||
static RGB_TO_F32_TABLE: LazyLock<[f32; 256]> = LazyLock::new(generate_rgb_to_linear_f32_table);
|
||||
|
||||
fn generate_rgb_to_srgb8_table() -> [u8; 256] {
|
||||
let mut table = [0; 256];
|
||||
@@ -330,9 +329,7 @@ impl From<Color> for SrgbaTuple {
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref NAMED_COLORS: HashMap<String, SrgbaTuple> = build_colors();
|
||||
}
|
||||
static NAMED_COLORS: LazyLock<HashMap<String, SrgbaTuple>> = LazyLock::new(build_colors);
|
||||
|
||||
fn build_colors() -> HashMap<String, SrgbaTuple> {
|
||||
let mut map = HashMap::new();
|
||||
|
||||
@@ -22,7 +22,6 @@ fixedbitset.workspace = true
|
||||
fnv = {workspace=true, optional=true}
|
||||
hex.workspace = true
|
||||
image = {workspace=true, optional=true}
|
||||
lazy_static.workspace = true
|
||||
libc.workspace = true
|
||||
log.workspace = true
|
||||
memmem.workspace = true
|
||||
|
||||
@@ -10,6 +10,7 @@ use std::collections::HashMap;
|
||||
use std::fmt::{Display, Error as FmtError, Formatter, Result as FmtResult};
|
||||
use std::str;
|
||||
use std::str::FromStr;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum ColorOrQuery {
|
||||
@@ -483,9 +484,7 @@ struct OscMap {
|
||||
variant_to_code: HashMap<OperatingSystemCommandCode, &'static str>,
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref OSC_MAP: OscMap = OscMap::new();
|
||||
}
|
||||
static OSC_MAP: LazyLock<OscMap> = LazyLock::new(OscMap::new);
|
||||
|
||||
impl OperatingSystemCommandCode {
|
||||
fn from_code(code: &str) -> Option<Self> {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref NERD_FONTS: HashMap<&'static str, char> = build_map();
|
||||
}
|
||||
pub static NERD_FONTS: LazyLock<HashMap<&'static str, char>> = LazyLock::new(build_map);
|
||||
|
||||
pub use crate::nerdfonts_data::NERD_FONT_GLYPHS;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ license = "MIT"
|
||||
[dependencies]
|
||||
bitflags.workspace = true
|
||||
euclid.workspace = true
|
||||
lazy_static.workspace = true
|
||||
serde = {workspace=true, features = ["rc", "derive"], optional=true}
|
||||
wezterm-dynamic.workspace = true
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt::Write;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, LazyLock};
|
||||
use wezterm_dynamic::{FromDynamic, ToDynamic};
|
||||
|
||||
pub struct PixelUnit;
|
||||
@@ -1141,10 +1141,10 @@ impl PhysKeyCode {
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref PHYSKEYCODE_MAP: HashMap<String, PhysKeyCode> = PhysKeyCode::make_map();
|
||||
static ref INV_PHYSKEYCODE_MAP: HashMap<PhysKeyCode, String> = PhysKeyCode::make_inv_map();
|
||||
}
|
||||
static PHYSKEYCODE_MAP: LazyLock<HashMap<String, PhysKeyCode>> =
|
||||
LazyLock::new(PhysKeyCode::make_map);
|
||||
static INV_PHYSKEYCODE_MAP: LazyLock<HashMap<PhysKeyCode, String>> =
|
||||
LazyLock::new(PhysKeyCode::make_inv_map);
|
||||
|
||||
impl TryFrom<&str> for PhysKeyCode {
|
||||
type Error = String;
|
||||
|
||||
Reference in new issue
Block a user