mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2025-01-03 12:39:35 +00:00
replace lazy_static
with once_cell
This commit is contained in:
parent
6c42373bd7
commit
7d02dfadd0
4 changed files with 79 additions and 96 deletions
27
Cargo.lock
generated
27
Cargo.lock
generated
|
@ -82,9 +82,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "0.7.20"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
@ -1968,16 +1968,15 @@ dependencies = [
|
||||||
"hyper-tls",
|
"hyper-tls",
|
||||||
"image",
|
"image",
|
||||||
"is_elevated",
|
"is_elevated",
|
||||||
"lazy_static",
|
|
||||||
"log",
|
"log",
|
||||||
"num-format",
|
"num-format",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
|
"once_cell",
|
||||||
"portable-pty",
|
"portable-pty",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"regex",
|
"regex",
|
||||||
"rfd",
|
"rfd",
|
||||||
"serde",
|
"serde",
|
||||||
"serde-xml-rs",
|
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"static_vcruntime",
|
"static_vcruntime",
|
||||||
"strsim",
|
"strsim",
|
||||||
|
@ -3451,9 +3450,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.7.3"
|
version = "1.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
|
checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
@ -3462,9 +3461,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.29"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "renderdoc-sys"
|
name = "renderdoc-sys"
|
||||||
|
@ -3715,18 +3714,6 @@ dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde-xml-rs"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782"
|
|
||||||
dependencies = [
|
|
||||||
"log",
|
|
||||||
"serde",
|
|
||||||
"thiserror",
|
|
||||||
"xml-rs",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.159"
|
version = "1.0.159"
|
||||||
|
|
|
@ -46,10 +46,10 @@ figment = { version = "0.10.8", features = ["toml"] }
|
||||||
hyper = "0.14.20"
|
hyper = "0.14.20"
|
||||||
hyper-tls = "0.5.0"
|
hyper-tls = "0.5.0"
|
||||||
image = { version = "0.24.4", features = ["png"] }
|
image = { version = "0.24.4", features = ["png"] }
|
||||||
lazy_static = "1.4.0"
|
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
num_cpus = "1.13.1"
|
num_cpus = "1.13.1"
|
||||||
num-format = { version = "0.4.3", default-features = false }
|
num-format = { version = "0.4.3", default-features = false }
|
||||||
|
once_cell = "1.17.1"
|
||||||
portable-pty = "0.7.0"
|
portable-pty = "0.7.0"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
regex = { version = "1.6.0", default-features = false, features = ["perf"] }
|
regex = { version = "1.6.0", default-features = false, features = ["perf"] }
|
||||||
|
@ -64,7 +64,6 @@ toml = { version = "0.5.9", features = ["preserve_order"] }
|
||||||
tor-rtcompat = "0.7.0"
|
tor-rtcompat = "0.7.0"
|
||||||
walkdir = "2.3.2"
|
walkdir = "2.3.2"
|
||||||
zeroize = "1.5.7"
|
zeroize = "1.5.7"
|
||||||
serde-xml-rs = "0.6.0"
|
|
||||||
strsim = "0.10.0"
|
strsim = "0.10.0"
|
||||||
|
|
||||||
# Unix dependencies
|
# Unix dependencies
|
||||||
|
|
135
src/constants.rs
135
src/constants.rs
|
@ -401,79 +401,78 @@ use egui::style::{
|
||||||
Widgets,
|
Widgets,
|
||||||
WidgetVisuals,
|
WidgetVisuals,
|
||||||
};
|
};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
pub const ACCENT_COLOR: Color32 = Color32::from_rgb(200, 100, 100);
|
pub const ACCENT_COLOR: Color32 = Color32::from_rgb(200, 100, 100);
|
||||||
pub const BG: Color32 = Color32::from_gray(20);
|
pub const BG: Color32 = Color32::from_gray(20);
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
// This is based off [`Visuals::dark()`].
|
||||||
/// This is based off [`Visuals::dark()`].
|
pub static VISUALS: Lazy<Visuals> = Lazy::new(|| {
|
||||||
pub static ref VISUALS: Visuals = {
|
let selection = Selection {
|
||||||
let selection = Selection {
|
bg_fill: ACCENT_COLOR,
|
||||||
bg_fill: ACCENT_COLOR,
|
stroke: Stroke::new(1.0, Color32::from_gray(255)),
|
||||||
stroke: Stroke::new(1.0, Color32::from_gray(255)),
|
|
||||||
};
|
|
||||||
|
|
||||||
let widgets = Widgets {
|
|
||||||
noninteractive: WidgetVisuals {
|
|
||||||
bg_fill: BG,
|
|
||||||
bg_stroke: Stroke::new(1.0, Color32::from_gray(60)), // separators, indentation lines
|
|
||||||
fg_stroke: Stroke::new(1.0, Color32::from_gray(140)), // normal text color
|
|
||||||
rounding: Rounding::same(10.0),
|
|
||||||
expansion: 0.0,
|
|
||||||
},
|
|
||||||
inactive: WidgetVisuals {
|
|
||||||
bg_fill: Color32::from_gray(50),
|
|
||||||
bg_stroke: Default::default(),
|
|
||||||
fg_stroke: Stroke::new(1.0, Color32::from_gray(180)), // button text
|
|
||||||
rounding: Rounding::same(10.0),
|
|
||||||
expansion: 0.0,
|
|
||||||
},
|
|
||||||
hovered: WidgetVisuals {
|
|
||||||
bg_fill: Color32::from_gray(80),
|
|
||||||
bg_stroke: Stroke::new(1.0, Color32::from_gray(150)), // e.g. hover over window edge or button
|
|
||||||
fg_stroke: Stroke::new(1.5, Color32::from_gray(240)),
|
|
||||||
rounding: Rounding::same(10.0),
|
|
||||||
expansion: 1.0,
|
|
||||||
},
|
|
||||||
active: WidgetVisuals {
|
|
||||||
bg_fill: Color32::from_gray(55),
|
|
||||||
bg_stroke: Stroke::new(1.0, Color32::WHITE),
|
|
||||||
fg_stroke: Stroke::new(2.0, Color32::WHITE),
|
|
||||||
rounding: Rounding::same(10.0),
|
|
||||||
expansion: 1.0,
|
|
||||||
},
|
|
||||||
open: WidgetVisuals {
|
|
||||||
bg_fill: Color32::from_gray(27),
|
|
||||||
bg_stroke: Stroke::new(1.0, Color32::from_gray(60)),
|
|
||||||
fg_stroke: Stroke::new(1.0, Color32::from_gray(210)),
|
|
||||||
rounding: Rounding::same(10.0),
|
|
||||||
expansion: 0.0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
Visuals {
|
|
||||||
dark_mode: true,
|
|
||||||
override_text_color: None,
|
|
||||||
widgets,
|
|
||||||
selection,
|
|
||||||
hyperlink_color: Color32::from_rgb(90, 170, 255),
|
|
||||||
faint_bg_color: Color32::from_additive_luminance(5), // visible, but barely so
|
|
||||||
extreme_bg_color: Color32::from_gray(10), // e.g. TextEdit background
|
|
||||||
code_bg_color: Color32::from_gray(64),
|
|
||||||
warn_fg_color: Color32::from_rgb(255, 143, 0), // orange
|
|
||||||
error_fg_color: Color32::from_rgb(255, 0, 0), // red
|
|
||||||
window_rounding: Rounding::same(6.0),
|
|
||||||
window_shadow: Shadow::big_dark(),
|
|
||||||
popup_shadow: Shadow::small_dark(),
|
|
||||||
resize_corner_size: 12.0,
|
|
||||||
text_cursor_width: 2.0,
|
|
||||||
text_cursor_preview: false,
|
|
||||||
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
|
|
||||||
button_frame: true,
|
|
||||||
collapsing_header_frame: false,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
let widgets = Widgets {
|
||||||
|
noninteractive: WidgetVisuals {
|
||||||
|
bg_fill: BG,
|
||||||
|
bg_stroke: Stroke::new(1.0, Color32::from_gray(60)), // separators, indentation lines
|
||||||
|
fg_stroke: Stroke::new(1.0, Color32::from_gray(140)), // normal text color
|
||||||
|
rounding: Rounding::same(10.0),
|
||||||
|
expansion: 0.0,
|
||||||
|
},
|
||||||
|
inactive: WidgetVisuals {
|
||||||
|
bg_fill: Color32::from_gray(50),
|
||||||
|
bg_stroke: Default::default(),
|
||||||
|
fg_stroke: Stroke::new(1.0, Color32::from_gray(180)), // button text
|
||||||
|
rounding: Rounding::same(10.0),
|
||||||
|
expansion: 0.0,
|
||||||
|
},
|
||||||
|
hovered: WidgetVisuals {
|
||||||
|
bg_fill: Color32::from_gray(80),
|
||||||
|
bg_stroke: Stroke::new(1.0, Color32::from_gray(150)), // e.g. hover over window edge or button
|
||||||
|
fg_stroke: Stroke::new(1.5, Color32::from_gray(240)),
|
||||||
|
rounding: Rounding::same(10.0),
|
||||||
|
expansion: 1.0,
|
||||||
|
},
|
||||||
|
active: WidgetVisuals {
|
||||||
|
bg_fill: Color32::from_gray(55),
|
||||||
|
bg_stroke: Stroke::new(1.0, Color32::WHITE),
|
||||||
|
fg_stroke: Stroke::new(2.0, Color32::WHITE),
|
||||||
|
rounding: Rounding::same(10.0),
|
||||||
|
expansion: 1.0,
|
||||||
|
},
|
||||||
|
open: WidgetVisuals {
|
||||||
|
bg_fill: Color32::from_gray(27),
|
||||||
|
bg_stroke: Stroke::new(1.0, Color32::from_gray(60)),
|
||||||
|
fg_stroke: Stroke::new(1.0, Color32::from_gray(210)),
|
||||||
|
rounding: Rounding::same(10.0),
|
||||||
|
expansion: 0.0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Visuals {
|
||||||
|
dark_mode: true,
|
||||||
|
override_text_color: None,
|
||||||
|
widgets,
|
||||||
|
selection,
|
||||||
|
hyperlink_color: Color32::from_rgb(90, 170, 255),
|
||||||
|
faint_bg_color: Color32::from_additive_luminance(5), // visible, but barely so
|
||||||
|
extreme_bg_color: Color32::from_gray(10), // e.g. TextEdit background
|
||||||
|
code_bg_color: Color32::from_gray(64),
|
||||||
|
warn_fg_color: Color32::from_rgb(255, 143, 0), // orange
|
||||||
|
error_fg_color: Color32::from_rgb(255, 0, 0), // red
|
||||||
|
window_rounding: Rounding::same(6.0),
|
||||||
|
window_shadow: Shadow::big_dark(),
|
||||||
|
popup_shadow: Shadow::small_dark(),
|
||||||
|
resize_corner_size: 12.0,
|
||||||
|
text_cursor_width: 2.0,
|
||||||
|
text_cursor_preview: false,
|
||||||
|
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
|
||||||
|
button_frame: true,
|
||||||
|
collapsing_header_frame: false,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- TESTS
|
//---------------------------------------------------------------------------------------------------- TESTS
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
10
src/regex.rs
10
src/regex.rs
|
@ -18,14 +18,12 @@
|
||||||
// Some regexes used throughout Gupax.
|
// Some regexes used throughout Gupax.
|
||||||
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use lazy_static::lazy_static;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Lazy
|
//---------------------------------------------------------------------------------------------------- Lazy
|
||||||
lazy_static! {
|
pub static REGEXES: Lazy<Regexes> = Lazy::new(|| Regexes::new());
|
||||||
pub static ref REGEXES: Regexes = Regexes::new();
|
pub static P2POOL_REGEX: Lazy<P2poolRegex> = Lazy::new(|| P2poolRegex::new());
|
||||||
pub static ref P2POOL_REGEX: P2poolRegex = P2poolRegex::new();
|
pub static XMRIG_REGEX: Lazy<XmrigRegex> = Lazy::new(|| XmrigRegex::new());
|
||||||
pub static ref XMRIG_REGEX: XmrigRegex = XmrigRegex::new();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- [Regexes] struct
|
//---------------------------------------------------------------------------------------------------- [Regexes] struct
|
||||||
// General purpose Regexes, mostly used in the GUI.
|
// General purpose Regexes, mostly used in the GUI.
|
||||||
|
|
Loading…
Reference in a new issue