summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/visualize
diff options
context:
space:
mode:
authorAbdul-Rahman Sibahi <asibahi@users.noreply.github.com>2024-10-31 14:52:11 +0300
committerGitHub <noreply@github.com>2024-10-31 11:52:11 +0000
commitb969c01b282287b44c3e131f8c0c53dcbb304e30 (patch)
treefe58484bfa76e7fe7a35bf0bffdc339b24621693 /crates/typst-library/src/visualize
parent644ed252dda1a0785d2bee577a89322416f4d950 (diff)
Replace `once_cell`'s `Lazy` as much as possible (#4617)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-library/src/visualize')
-rw-r--r--crates/typst-library/src/visualize/color.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/typst-library/src/visualize/color.rs b/crates/typst-library/src/visualize/color.rs
index 1a279fbb..8ff8dbdb 100644
--- a/crates/typst-library/src/visualize/color.rs
+++ b/crates/typst-library/src/visualize/color.rs
@@ -1,9 +1,9 @@
use std::fmt::{self, Debug, Formatter};
use std::hash::{Hash, Hasher};
use std::str::FromStr;
+use std::sync::LazyLock;
use ecow::{eco_format, EcoString, EcoVec};
-use once_cell::sync::Lazy;
use palette::encoding::{self, Linear};
use palette::{
Alpha, Darken, Desaturate, FromColor, Lighten, OklabHue, RgbHue, Saturate, ShiftHue,
@@ -33,17 +33,18 @@ pub type Luma = palette::luma::Lumaa<encoding::Srgb, f32>;
/// to convert from CMYK to RGB. It is based on the CGATS TR 001-1995
/// specification. See
/// <https://github.com/saucecontrol/Compact-ICC-Profiles#cmyk>.
-static CMYK_TO_XYZ: Lazy<Box<Profile>> =
- Lazy::new(|| Profile::new_from_slice(typst_assets::icc::CMYK_TO_XYZ, false).unwrap());
+static CMYK_TO_XYZ: LazyLock<Box<Profile>> = LazyLock::new(|| {
+ Profile::new_from_slice(typst_assets::icc::CMYK_TO_XYZ, false).unwrap()
+});
/// The target sRGB profile.
-static SRGB_PROFILE: Lazy<Box<Profile>> = Lazy::new(|| {
+static SRGB_PROFILE: LazyLock<Box<Profile>> = LazyLock::new(|| {
let mut out = Profile::new_sRGB();
out.precache_output_transform();
out
});
-static TO_SRGB: Lazy<qcms::Transform> = Lazy::new(|| {
+static TO_SRGB: LazyLock<qcms::Transform> = LazyLock::new(|| {
qcms::Transform::new_to(
&CMYK_TO_XYZ,
&SRGB_PROFILE,