Debian Codegraph @

src/luv.rs

raw symbols SCIP
1 //! Types for the CIE L\*u\*v\* (CIELUV) color space.
2
3 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{
4 markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
5 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#, Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#, Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#},
6 };
7
8 use craterust-analyzer cargo palette 0.7.6 crate/::{
9 anglerust-analyzer cargo palette 0.7.6 angle/::RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#,
10 bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/::{HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#},
11 convertrust-analyzer cargo palette 0.7.6 convert/::FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#,
12 numrust-analyzer cargo palette 0.7.6 num/::{Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, MinMaxrust-analyzer cargo palette 0.7.6 num/MinMax#, PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#, Powfrust-analyzer cargo palette 0.7.6 num/Powf#, Powirust-analyzer cargo palette 0.7.6 num/Powi#, Realrust-analyzer cargo palette 0.7.6 num/Real#, Reciprust-analyzer cargo palette 0.7.6 num/Recip#, Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#},
13 white_pointrust-analyzer cargo palette 0.7.6 white_point/::{WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#, D65rust-analyzer cargo palette 0.7.6 white_point/D65#},
14 Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#, FromColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#, GetHuerust-analyzer cargo palette 0.7.6 GetHue#, Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#, LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#, Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#,
15 };
16
17 /// CIE L\*u\*v\* (CIELUV) with an alpha component. See the [`Luva`
18 /// implementation in `Alpha`](crate::Alpha#Luva).
19 pub type Luvarust-analyzer cargo palette 0.7.6 luv/Luva#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> = Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>, T>;
20
21 /// The CIE L\*u\*v\* (CIELUV) color space.
22 ///
23 /// CIE L\*u\*v\* is a device independent color space. It is a simple
24 /// transformation of the CIE XYZ color space with the additional
25 /// property of being more perceptually uniform. In contrast to
26 /// CIELAB, CIELUV is also linear for a fixed lightness: additive
27 /// mixtures of colors (at a fixed lightness) will fall on a line in
28 /// CIELUV-space.
29 ///
30 /// As a result, CIELUV is used more frequently for additive settings.
31 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, ArrayCastrust-analyzer cargo palette_derive 0.7.6 ArrayCast:, FromColorUnclampedrust-analyzer cargo palette_derive 0.7.6 FromColorUnclamped:, WithAlpharust-analyzer cargo palette_derive 0.7.6 WithAlpha:)]
32 #[cfg_attr(feature = "serializing", derive(Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:))]
33 #[palette(
34 palette_internal,
35 white_point = "Wp",
36 component = "T",
37 skip_derives(Xyz, Luv, Lchuv)
38 )]
39 #[repr(C)]
40 pub struct Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> {
41 /// L\* is the lightness of the color. 0.0 gives absolute black and 100
42 /// give the brightest white.
43 pub lrust-analyzer cargo palette 0.7.6 luv/Luv#l.: T,
44
45 /// The range of valid u\* varies depending on the values of L\*
46 /// and v\*, but at its limits u\* is within the interval (-84.0,
47 /// 176.0).
48 pub urust-analyzer cargo palette 0.7.6 luv/Luv#u.: T,
49
50 /// The range of valid v\* varies depending on the values of L\*
51 /// and u\*, but at its limits v\* is within the interval (-135.0,
52 /// 108.0).
53 pub vrust-analyzer cargo palette 0.7.6 luv/Luv#v.: T,
54
55 /// The white point associated with the color's illuminant and observer.
56 /// D65 for 2 degree observer is used by default.
57 #[cfg_attr(feature = "serializing", serde(skip))]
58 #[paletterust-analyzer cargo palette_derive 0.7.6 palette:(unsafe_zero_sized)]
59 pub white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Wp>,
60 }
61
62 impl<Wp, T> Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T> {
63 /// Create a CIE L\*u\*v\* color.
64 pub const fn newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(l: T, u: T, v: T) -> Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`] {
65 Luvrust-analyzer cargo palette 0.7.6 luv/Luv# {
66 lrust-analyzer cargo palette 0.7.6 luv/Luv#l.,
67 urust-analyzer cargo palette 0.7.6 luv/Luv#u.,
68 vrust-analyzer cargo palette 0.7.6 luv/Luv#v.,
69 white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
70 }
71 }
72
73 /// Convert to a `(L\*, u\*, v\*)` tuple.
74 pub fn into_componentsrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]into_components().(self) -> (T, T, T) {
75 (self.lrust-analyzer cargo palette 0.7.6 luv/Luv#l., self.urust-analyzer cargo palette 0.7.6 luv/Luv#u., self.vrust-analyzer cargo palette 0.7.6 luv/Luv#v.)
76 }
77
78 /// Convert from a `(L\*, u\*, v\*)` tuple.
79 pub fn from_componentsrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]from_components().((l, u, v): (T, T, T)) -> Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`] {
80 Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(l, u, v)
81 }
82 }
83
84 impl<Wp, T> Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>
85 where
86 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Realrust-analyzer cargo palette 0.7.6 num/Real#,
87 {
88 /// Return the `l` value minimum.
89 pub fn min_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_l().() -> T {
90 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
91 }
92
93 /// Return the `l` value maximum.
94 pub fn max_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_l().() -> T {
95 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0)
96 }
97
98 /// Return the `u` value minimum.
99 pub fn min_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_u().() -> T {
100 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().84.0)
101 }
102
103 /// Return the `u` value maximum.
104 pub fn max_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_u().() -> T {
105 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(176.0)
106 }
107
108 /// Return the `v` value minimum.
109 pub fn min_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_v().() -> T {
110 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().135.0)
111 }
112
113 /// Return the `v` value maximum.
114 pub fn max_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_v().() -> T {
115 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(108.0)
116 }
117 }
118
119 ///<span id="Luva"></span>[`Luva`](crate::Luva) implementations.
120 impl<Wp, T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>, A> {
121 /// Create a CIE L\*u\*v\* color with transparency.
122 pub const fn newrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]new().(l: T, u: T, v: T, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`] {
123 Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# {
124 colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(l, u, v),
125 alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.,
126 }
127 }
128
129 /// Convert to u `(L\*, u\*, v\*, alpha)` tuple.
130 pub fn into_componentsrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]into_components().(self) -> (T, T, T, A) {
131 (self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..lrust-analyzer cargo palette 0.7.6 luv/Luv#l., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..urust-analyzer cargo palette 0.7.6 luv/Luv#u., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..vrust-analyzer cargo palette 0.7.6 luv/Luv#v., self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.)
132 }
133
134 /// Convert from u `(L\*, u\*, v\*, alpha)` tuple.
135 pub fn from_componentsrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]from_components().((l, u, v, alpha): (T, T, T, A)) -> Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`] {
136 Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]new().(l, u, v, alpha)
137 }
138 }
139
140 impl_reference_component_methodsrust-analyzer cargo palette 0.7.6 macros/reference_component/impl_reference_component_methods!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
141 impl_struct_of_arrays_methodsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_arrays_methods!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [l, u, v], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
142
143 impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>> for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T> {
144 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`FromColorUnclamped<Self>`]from_color_unclamped().(color: Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`FromColorUnclamped<Self>`] {
145 color
146 }
147 }
148
149 impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>> for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>
150 where
151 T: RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# + Zerorust-analyzer cargo palette 0.7.6 num/Zero# + MinMaxrust-analyzer cargo palette 0.7.6 num/MinMax# + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# + Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# = T> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
152 {
153 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`FromColorUnclamped<Lchuv<Wp, T>>`]from_color_unclamped().(color: Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`FromColorUnclamped<Lchuv<Wp, T>>`] {
154 let (sin_hue, cos_hue) = color.huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue..into_raw_radiansrust-analyzer cargo palette 0.7.6 hues/impl#[`LuvHue<T>`]into_raw_radians().().sin_cosrust-analyzer cargo palette 0.7.6 num/Trigonometry#sin_cos().();
155 let chroma = color.chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma..maxrust-analyzer cargo palette 0.7.6 num/MinMax#max().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().());
156
157 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(color.lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chroma.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().cos_hue, chroma rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().sin_hue)
158 }
159 }
160
161 impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>> for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>
162 where
163 Wp: WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#<T>,
164 T: Realrust-analyzer cargo palette 0.7.6 num/Real#
165 + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
166 + Powirust-analyzer cargo palette 0.7.6 num/Powi#
167 + Powfrust-analyzer cargo palette 0.7.6 num/Powf#
168 + Reciprust-analyzer cargo palette 0.7.6 num/Recip#
169 + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#
170 + PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#
171 + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#
172 + HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool>,
173 {
174 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`FromColorUnclamped<Xyz<Wp, T>>`]from_color_unclamped().(color: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`FromColorUnclamped<Xyz<Wp, T>>`] {
175 let w = Wp::get_xyzrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#get_xyz().();
176
177 let kappa = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(29.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().3.0).powirust-analyzer cargo palette 0.7.6 num/Powi#powi().(3);
178 let epsilon = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(6.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().29.0).powirust-analyzer cargo palette 0.7.6 num/Powi#powi().(3);
179
180 let prime_denom =
181 color.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(15.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&color.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(3.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().color.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.;
182 if prime_denom rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.0) {
183 return Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().());
184 }
185 let prime_denom_recip = prime_denom.reciprust-analyzer cargo palette 0.7.6 num/Recip#recip().();
186 let prime_ref_denom_recip =
187 (w.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(15.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&w.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(3.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().w.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.).reciprust-analyzer cargo palette 0.7.6 num/Recip#recip().();
188
189 let u_prime: T = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(4.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().color.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&prime_denom_recip;
190 let u_ref_prime = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(4.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().w.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&prime_ref_denom_recip;
191
192 let v_prime: T = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(9.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&color.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().prime_denom_recip;
193 let v_ref_prime = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(9.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&w.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().prime_ref_denom_recip;
194
195 let y_r = color.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().w.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.;
196 let l = if y_r rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().epsilon {
197 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(116.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().y_r.powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().3.0)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(16.0)
198 } else {
199 kappa rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().y_r
200 };
201
202 Luvrust-analyzer cargo palette 0.7.6 luv/Luv# {
203 urust-analyzer cargo palette 0.7.6 luv/Luv#u.: T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(13.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&l rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().(u_prime rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().u_ref_prime),
204 vrust-analyzer cargo palette 0.7.6 luv/Luv#v.: T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(13.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&l rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().(v_prime rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().v_ref_prime),
205 lrust-analyzer cargo palette 0.7.6 luv/Luv#l.,
206 white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
207 }
208 }
209 }
210
211 impl_tuple_conversionrust-analyzer cargo palette 0.7.6 macros/convert/impl_tuple_conversion!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> as (T, T, T));
212
213 impl_is_within_boundsrust-analyzer cargo palette 0.7.6 macros/clamp/impl_is_within_bounds!! {
214 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> {
215 lrust-analyzer cargo palette 0.7.6 luv/Luv#l. => [Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][IsWithinBounds]::min_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][IsWithinBounds]::max_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_l().()],
216 urust-analyzer cargo palette 0.7.6 luv/Luv#u. => [Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][IsWithinBounds]::min_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_u().(), Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][IsWithinBounds]::max_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_u().()],
217 vrust-analyzer cargo palette 0.7.6 luv/Luv#v. => [Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][IsWithinBounds]::min_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_v().(), Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][IsWithinBounds]::max_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_v().()]
218 }
219 where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
220 }
221 impl_clamprust-analyzer cargo palette 0.7.6 macros/clamp/impl_clamp!! {
222 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> {
223 lrust-analyzer cargo palette 0.7.6 luv/Luv#l. => [Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][ClampAssign]::min_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][ClampAssign]::max_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_l().()],
224 urust-analyzer cargo palette 0.7.6 luv/Luv#u. => [Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][ClampAssign]::min_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_u().(), Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][ClampAssign]::max_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_u().()],
225 vrust-analyzer cargo palette 0.7.6 luv/Luv#v. => [Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][ClampAssign]::min_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_v().(), Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][ClampAssign]::max_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_v().()]
226 }
227 other {white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.}
228 where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
229 }
230
231 impl_mixrust-analyzer cargo palette 0.7.6 macros/mix/impl_mix!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>);
232 impl_lightenrust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_lighten!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> increase {l => [Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][Lighten]::min_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][Lighten]::max_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_l().()]} other {urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.} phantom: white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
233 impl_premultiplyrust-analyzer cargo palette 0.7.6 macros/blend/impl_premultiply!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> {lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.} phantom: white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
234 impl_euclidean_distancerust-analyzer cargo palette 0.7.6 macros/color_difference/impl_euclidean_distance!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> {lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.});
235 impl_hyabrust-analyzer cargo palette 0.7.6 macros/color_difference/impl_hyab!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> {lightness: lrust-analyzer cargo palette 0.7.6 luv/Luv#l., chroma1: urust-analyzer cargo palette 0.7.6 luv/Luv#u., chroma2: vrust-analyzer cargo palette 0.7.6 luv/Luv#v.});
236 impl_lab_color_schemesrust-analyzer cargo palette 0.7.6 macros/color_theory/impl_lab_color_schemes!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>[urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.][lrust-analyzer cargo palette 0.7.6 luv/Luv#l., white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.]);
237
238 impl<Wp, T> GetHuerust-analyzer cargo palette 0.7.6 GetHue# for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>
239 where
240 T: RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# + Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<T, Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#Output# = T> + Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#Output# = T> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
241 {
242 type Huerust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][GetHue]Hue# = LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>;
243
244 fn get_huerust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][GetHue]get_hue().(&self) -> LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T> {
245 LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#::from_cartesianrust-analyzer cargo palette 0.7.6 hues/impl#[`LuvHue<T>`]from_cartesian().(self.urust-analyzer cargo palette 0.7.6 luv/Luv#u..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), self.vrust-analyzer cargo palette 0.7.6 luv/Luv#v..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
246 }
247 }
248
249 impl<Wp, T> HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask# for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>
250 where
251 T: HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#,
252 {
253 type Maskrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][HasBoolMask]Mask# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#;
254 }
255
256 impl<Wp, T> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>
257 where
258 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero#,
259 {
260 fn defaultrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][Default]default().() -> Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T> {
261 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().())
262 }
263 }
264
265 impl_color_addrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_add!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
266 impl_color_subrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_sub!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
267 impl_color_mulrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_mul!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
268 impl_color_divrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_div!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
269
270 impl_array_castsrust-analyzer cargo palette 0.7.6 macros/casting/impl_array_casts!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>, [T; 3]);
271 impl_simd_array_conversionrust-analyzer cargo palette 0.7.6 macros/simd/impl_simd_array_conversion!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [l, u, v], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
272 impl_struct_of_array_traitsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_array_traits!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
273
274 impl_eqrust-analyzer cargo palette 0.7.6 macros/equality/impl_eq!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.]);
275 impl_copy_clonerust-analyzer cargo palette 0.7.6 macros/copy_clone/impl_copy_clone!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp>, [lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.], white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.);
276
277 #[allow(deprecated)]
278 impl<Wp, T> craterust-analyzer cargo palette 0.7.6 crate/::RelativeContrastrust-analyzer cargo palette 0.7.6 relative_contrast/RelativeContrast# for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>
279 where
280 T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#,
281 T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T>,
282 Wp: WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#<T>,
283 Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>: FromColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#<Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][RelativeContrast]>,
284 {
285 type Scalarrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][RelativeContrast]Scalar# = T;
286
287 #[inline]
288 fn get_contrast_ratiorust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][RelativeContrast]get_contrast_ratio().(self, other: Selfrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][RelativeContrast]) -> T {
289 let xyz1 = Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#from_color().(self);
290 let xyz2 = Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#from_color().(other);
291
292 craterust-analyzer cargo palette 0.7.6 crate/::contrast_ratiorust-analyzer cargo palette 0.7.6 relative_contrast/contrast_ratio().(xyz1.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y., xyz2.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.)
293 }
294 }
295
296 impl_rand_traits_cartesianrust-analyzer cargo palette 0.7.6 macros/random/impl_rand_traits_cartesian!!(
297 UniformLuvrust-analyzer cargo palette 0.7.6 luv/UniformLuv#,
298 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp> {
299 lrust-analyzer cargo palette 0.7.6 luv/Luv#l. => [|x| x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0)],
300 urust-analyzer cargo palette 0.7.6 luv/Luv#u. => [|x| x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(260.0) -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(84.0)],
301 vrust-analyzer cargo palette 0.7.6 luv/Luv#v. => [|x| x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(243.0) -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(135.0)]
302 }
303 phantom: white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.: PhantomData<Wp>
304 where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#Output# = T> + corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# = T>
305 );
306
307 #[cfg(feature = "bytemuck")]
308 unsafe impl<Wp, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# {}
309
310 #[cfg(feature = "bytemuck")]
311 unsafe impl<Wp: 'static, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# for Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# {}
312
313 #[cfg(test)]
314 mod testrust-analyzer cargo palette 0.7.6 luv/test/ {
315 use superrust-analyzer cargo palette 0.7.6 luv/::Luvrust-analyzer cargo palette 0.7.6 luv/Luv#;
316 use craterust-analyzer cargo palette 0.7.6 crate/::white_pointrust-analyzer cargo palette 0.7.6 white_point/::D65rust-analyzer cargo palette 0.7.6 white_point/D65#;
317
318 #[cfg(feature = "approx")]
319 use craterust-analyzer cargo palette 0.7.6 crate/::Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#;
320
321 test_convert_into_from_xyzrust-analyzer cargo palette 0.7.6 macros/convert/test_convert_into_from_xyz!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#);
322
323 #[cfg(feature = "approx")]
324 mod conversionrust-analyzer cargo palette 0.7.6 luv/test/conversion/ {
325 use craterust-analyzer cargo palette 0.7.6 crate/::{FromColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#, LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#, Luvrust-analyzer cargo palette 0.7.6 luv/Luv#};
326
327 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
328 fn redrust-analyzer cargo palette 0.7.6 luv/test/conversion/red().() {
329 let u = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/impl#[U][`FromColor<T>`]from_color().(LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(1.0, 0.0, 0.0));
330 let v = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(53.237116, 175.0098, 37.7650);
331 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(u, v, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01);
332 }
333
334 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
335 fn greenrust-analyzer cargo palette 0.7.6 luv/test/conversion/green().() {
336 let u = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/impl#[U][`FromColor<T>`]from_color().(LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 1.0, 0.0));
337 let v = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(87.73703, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().83.07975, 107.40136);
338 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(u, v, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01);
339 }
340
341 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
342 fn bluerust-analyzer cargo palette 0.7.6 luv/test/conversion/blue().() {
343 let u = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/impl#[U][`FromColor<T>`]from_color().(LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 0.0, 1.0));
344 let v = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(32.30087, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().9.40241, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().130.35109);
345 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(u, v, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01);
346 }
347 }
348
349 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
350 fn rangesrust-analyzer cargo palette 0.7.6 luv/test/ranges().() {
351 assert_rangesrust-analyzer cargo palette 0.7.6 macros/clamp/assert_ranges!! {
352 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f64>;
353 clamped {
354 l: 0.0 => 100.0,
355 u: -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().84.0 => 176.0,
356 v: -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().135.0 => 108.0
357 }
358 clamped_min {}
359 unclamped {}
360 }
361 }
362 /// Check that the arithmetic operations (add/sub) are all
363 /// implemented.
364 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
365 fn test_arithmeticrust-analyzer cargo palette 0.7.6 luv/test/test_arithmetic().() {
366 let luv = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(120.0, 40.0, 30.0);
367 let luv2 = Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(200.0, 30.0, 40.0);
368 let mut _luv3 = luv rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Add<Self>`]add().+rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Add<Self>`]add(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Add<Self>`]add().luv2;
369 _luv3 rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`AddAssign<Self>`]add_assign(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`AddAssign<Self>`]add_assign().luv2;
370 let mut _luv4 = luv2 rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Add<T>`]add().+rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Add<T>`]add(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Add<T>`]add().0.3;
371 _luv4 rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`AddAssign<T>`]add_assign().+=rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`AddAssign<T>`]add_assign(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`AddAssign<T>`]add_assign().0.1;
372
373 _luv3 = luv2 rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Sub<Self>`]sub().-rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Sub<Self>`]sub(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Sub<Self>`]sub().luv;
374 _luv3 = _luv4 rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Sub<T>`]sub().-rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Sub<T>`]sub(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`Sub<T>`]sub().0.1;
375 _luv4 rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`SubAssign<Self>`]sub_assign()._luv3;
376 _luv3 rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`SubAssign<T>`]sub_assign().-=rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`SubAssign<T>`]sub_assign(). rust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`][`SubAssign<T>`]sub_assign().0.1;
377 }
378
379 raw_pixel_conversion_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_tests!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: l, u, v);
380 raw_pixel_conversion_fail_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_fail_tests!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: l, u, v);
381
382 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
383 fn check_min_max_componentsrust-analyzer cargo palette 0.7.6 luv/test/check_min_max_components().() {
384 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_l().(), 0.0);
385 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_u().(), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().84.0);
386 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]min_v().(), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().135.0);
387 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_lrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_l().(), 100.0);
388 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_urust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_u().(), 176.0);
389 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_vrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]max_v().(), 108.0);
390 }
391
392 struct_of_arrays_testsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/struct_of_arrays_tests!!(
393 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>[lrust-analyzer cargo palette 0.7.6 luv/Luv#l., urust-analyzer cargo palette 0.7.6 luv/Luv#u., vrust-analyzer cargo palette 0.7.6 luv/Luv#v.] phantom: white_pointrust-analyzer cargo palette 0.7.6 luv/Luv#white_point.,
394 superrust-analyzer cargo palette 0.7.6 luv/::Luvarust-analyzer cargo palette 0.7.6 luv/Luva#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]new().(0.1f32, 0.2, 0.3, 0.4),
395 superrust-analyzer cargo palette 0.7.6 luv/::Luvarust-analyzer cargo palette 0.7.6 luv/Luva#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]new().(0.2, 0.3, 0.4, 0.5),
396 superrust-analyzer cargo palette 0.7.6 luv/::Luvarust-analyzer cargo palette 0.7.6 luv/Luva#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Alpha<Luv<Wp, T>, A>`]new().(0.3, 0.4, 0.5, 0.6)
397 );
398
399 #[cfg(feature = "serializing")]
400 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
401 fn serializerust-analyzer cargo palette 0.7.6 luv/test/serialize().() {
402 let serialized = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::to_stringrust-analyzer cargo serde_json 1.0.116 ser/to_string().(&Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(80.0, 20.0, 30.0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
403
404 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(serialized, r#"{"l":80.0,"u":20.0,"v":30.0}"#);
405 }
406
407 #[cfg(feature = "serializing")]
408 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
409 fn deserializerust-analyzer cargo palette 0.7.6 luv/test/deserialize().() {
410 let deserialized: Luvrust-analyzer cargo palette 0.7.6 luv/Luv# = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::from_strrust-analyzer cargo serde_json 1.0.116 de/from_str().(r#"{"l":80.0,"u":20.0,"v":30.0}"#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
411
412 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(deserialized, Luvrust-analyzer cargo palette 0.7.6 luv/Luv#::newrust-analyzer cargo palette 0.7.6 luv/impl#[`Luv<Wp, T>`]new().(80.0, 20.0, 30.0));
413 }
414
415 test_uniform_distributionrust-analyzer cargo palette 0.7.6 macros/random/test_uniform_distribution!! {
416 Luv<D65, f32> {
417 l: (0.0, 100.0),
418 u: (-84.0, 176.0),
419 v: (-135.0, 108.0)
420 },
421 min: Luv::new(0.0f32, -84.0, -135.0),
422 max: Luv::new(100.0, 176.0, 108.0)
423 }
424
425 test_lab_color_schemesrust-analyzer cargo palette 0.7.6 macros/color_theory/test_lab_color_schemes!!(Luvrust-analyzer cargo palette 0.7.6 luv/Luv# / Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv# [u, v][l, white_point]);
426 }