Debian Codegraph @

src/yxy.rs

raw symbols SCIP
1 //! Types for the CIE 1931 Yxy (xyY) color space.
2
3 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::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#;
4
5 use craterust-analyzer cargo palette 0.7.6 crate/::{
6 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#},
7 convertrust-analyzer cargo palette 0.7.6 convert/::{FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#, IntoColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#},
8 encodingrust-analyzer cargo palette 0.7.6 encoding/::IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#,
9 lumarust-analyzer cargo palette 0.7.6 luma/::LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#,
10 numrust-analyzer cargo palette 0.7.6 num/::{Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, IsValidDivisorrust-analyzer cargo palette 0.7.6 num/IsValidDivisor#, Onerust-analyzer cargo palette 0.7.6 num/One#, PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#, Realrust-analyzer cargo palette 0.7.6 num/Real#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#},
11 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#},
12 Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#, Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#, Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#,
13 };
14
15 /// CIE 1931 Yxy (xyY) with an alpha component. See the [`Yxya` implementation
16 /// in `Alpha`](crate::Alpha#Yxya).
17 pub type Yxyarust-analyzer cargo palette 0.7.6 yxy/Yxya#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> = Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>, T>;
18
19 /// The CIE 1931 Yxy (xyY) color space.
20 ///
21 /// Yxy is a luminance-chromaticity color space derived from the CIE XYZ
22 /// color space. It is widely used to define colors. The chromaticity diagrams
23 /// for the color spaces are a plot of this color space's x and y coordinates.
24 ///
25 /// Conversions and operations on this color space depend on the white point.
26 #[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:)]
27 #[cfg_attr(feature = "serializing", derive(Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:))]
28 #[palette(
29 palette_internal,
30 white_point = "Wp",
31 component = "T",
32 skip_derives(Xyz, Yxy, Luma)
33 )]
34 #[repr(C)]
35 #[doc(alias = "xyY")]
36 pub struct Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> {
37 /// x chromaticity co-ordinate derived from XYZ color space as X/(X+Y+Z).
38 /// Typical range is between 0 and 1
39 pub xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x.: T,
40
41 /// y chromaticity co-ordinate derived from XYZ color space as Y/(X+Y+Z).
42 /// Typical range is between 0 and 1
43 pub yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y.: T,
44
45 /// luma (Y) was a measure of the brightness or luminance of a color.
46 /// It is the same as the Y from the XYZ color space. Its range is from
47 ///0 to 1, where 0 is black and 1 is white.
48 pub lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.: T,
49
50 /// The white point associated with the color's illuminant and observer.
51 /// D65 for 2 degree observer is used by default.
52 #[cfg_attr(feature = "serializing", serde(skip))]
53 #[paletterust-analyzer cargo palette_derive 0.7.6 palette:(unsafe_zero_sized)]
54 pub white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Wp>,
55 }
56
57 impl<Wp, T> Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T> {
58 /// Create a CIE Yxy color.
59 pub const fn newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(x: T, y: T, luma: T) -> Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T> {
60 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy# {
61 xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x.,
62 yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y.,
63 lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.,
64 white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
65 }
66 }
67
68 /// Convert to a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
69 pub fn into_componentsrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]into_components().(self) -> (T, T, T) {
70 (self.xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., self.yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., self.lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.)
71 }
72
73 /// Convert from a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
74 pub fn from_componentsrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]from_components().((x, y, luma): (T, T, T)) -> Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`] {
75 Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(x, y, luma)
76 }
77
78 /// Changes the reference white point without changing the color value.
79 ///
80 /// This function doesn't change the numerical values, and thus the color it
81 /// represents in an absolute sense. However, the appearance of the color
82 /// may not be the same when observed with the new white point. The effect
83 /// would be similar to taking a photo with an incorrect white balance.
84 ///
85 /// See [chromatic_adaptation](crate::chromatic_adaptation) for operations
86 /// that can change the white point while preserving the color's appearance.
87 #[inline]
88 pub fn with_white_pointrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]with_white_point().<NewWp>(self) -> Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<NewWp, T> {
89 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(self.xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., self.yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., self.lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.)
90 }
91 }
92
93 impl<Wp, T> Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>
94 where
95 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Onerust-analyzer cargo palette 0.7.6 num/One#,
96 {
97 /// Return the `x` value minimum.
98 pub fn min_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_x().() -> T {
99 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
100 }
101
102 /// Return the `x` value maximum.
103 pub fn max_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_x().() -> T {
104 T::onerust-analyzer cargo palette 0.7.6 num/One#one().()
105 }
106
107 /// Return the `y` value minimum.
108 pub fn min_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_y().() -> T {
109 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
110 }
111
112 /// Return the `y` value maximum.
113 pub fn max_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_y().() -> T {
114 T::onerust-analyzer cargo palette 0.7.6 num/One#one().()
115 }
116
117 /// Return the `luma` value minimum.
118 pub fn min_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_luma().() -> T {
119 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
120 }
121
122 /// Return the `luma` value maximum.
123 pub fn max_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_luma().() -> T {
124 T::onerust-analyzer cargo palette 0.7.6 num/One#one().()
125 }
126 }
127
128 ///<span id="Yxya"></span>[`Yxya`](crate::Yxya) implementations.
129 impl<Wp, T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>, A> {
130 /// Create a CIE Yxy color with transparency.
131 pub const fn newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]new().(x: T, y: T, luma: T, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`] {
132 Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# {
133 colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(x, y, luma),
134 alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.,
135 }
136 }
137
138 /// Convert to a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
139 pub fn into_componentsrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]into_components().(self) -> (T, T, T, A) {
140 (self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma., self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.)
141 }
142
143 /// Convert from a `(x, y, luma)`, a.k.a. `(x, y, Y)` tuple.
144 pub fn from_componentsrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]from_components().((x, y, luma, alpha): (T, T, T, A)) -> Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`] {
145 Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]new().(x, y, luma, alpha)
146 }
147
148 /// Changes the reference white point without changing the color value.
149 ///
150 /// This function doesn't change the numerical values, and thus the color it
151 /// represents in an absolute sense. However, the appearance of the color
152 /// may not be the same when observed with the new white point. The effect
153 /// would be similar to taking a photo with an incorrect white balance.
154 ///
155 /// See [chromatic_adaptation](crate::chromatic_adaptation) for operations
156 /// that can change the white point while preserving the color's appearance.
157 #[inline]
158 pub fn with_white_pointrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]with_white_point().<NewWp>(self) -> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<NewWp, T>, A> {
159 Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#::<Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<NewWp, T>, A>::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]new().(self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma., self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.)
160 }
161 }
162
163 impl_reference_component_methodsrust-analyzer cargo palette 0.7.6 macros/reference_component/impl_reference_component_methods!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
164 impl_struct_of_arrays_methodsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_arrays_methods!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [x, y, luma], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
165
166 impl_tuple_conversionrust-analyzer cargo palette 0.7.6 macros/convert/impl_tuple_conversion!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp> as (T, T, T));
167
168 impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>> for Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T> {
169 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][`FromColorUnclamped<Self>`]from_color_unclamped().(color: Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][`FromColorUnclamped<Self>`] {
170 color
171 }
172 }
173
174 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 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>
175 where
176 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + IsValidDivisorrust-analyzer cargo palette 0.7.6 num/IsValidDivisor# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
177 T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
178 {
179 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][`FromColorUnclamped<Xyz<Wp, T>>`]from_color_unclamped().(xyz: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][`FromColorUnclamped<Xyz<Wp, T>>`] {
180 let Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz# { xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x., yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y., zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z., .. } = xyz;
181
182 let sum = 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().&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().z;
183
184 // If denominator is zero, NAN or INFINITE leave x and y at the default 0
185 let mask = sum.is_valid_divisorrust-analyzer cargo palette 0.7.6 num/IsValidDivisor#is_valid_divisor().();
186 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy# {
187 xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x.: lazy_selectrust-analyzer cargo palette 0.7.6 macros/lazy_select/lazy_select!! {
188 if mask.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() => x /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). &sum,
189 else => T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(),
190 },
191 yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y.: lazy_selectrust-analyzer cargo palette 0.7.6 macros/lazy_select/lazy_select!! {
192 if mask => y.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/Div#div(). sum,
193 else => T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
194 },
195 lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.: y,
196 white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
197 }
198 }
199 }
200
201 impl<T, S> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>> for Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#, T>
202 where
203 S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#,
204 S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#<T, T>,
205 Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<<S as LumaStandard>::WhitePoint, T>`][`FromColorUnclamped<Luma<S, T>>`]: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#,
206 {
207 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<<S as LumaStandard>::WhitePoint, T>`][`FromColorUnclamped<Luma<S, T>>`]from_color_unclamped().(luma: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>) -> Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<<S as LumaStandard>::WhitePoint, T>`][`FromColorUnclamped<Luma<S, T>>`] {
208 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy# {
209 lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.: luma.into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_linear().().lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.,
210 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().()
211 }
212 }
213 }
214
215 impl_is_within_boundsrust-analyzer cargo palette 0.7.6 macros/clamp/impl_is_within_bounds!! {
216 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp> {
217 xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x. => [Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][IsWithinBounds]::min_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_x().(), Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][IsWithinBounds]::max_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_x().()],
218 yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y. => [Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][IsWithinBounds]::min_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_y().(), Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][IsWithinBounds]::max_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_y().()],
219 lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma. => [Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][IsWithinBounds]::min_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_luma().(), Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][IsWithinBounds]::max_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_luma().()]
220 }
221 where T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Onerust-analyzer cargo palette 0.7.6 num/One#
222 }
223 impl_clamprust-analyzer cargo palette 0.7.6 macros/clamp/impl_clamp!! {
224 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp> {
225 xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x. => [Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][ClampAssign]::min_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_x().(), Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][ClampAssign]::max_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_x().()],
226 yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y. => [Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][ClampAssign]::min_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_y().(), Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][ClampAssign]::max_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_y().()],
227 lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma. => [Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][ClampAssign]::min_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_luma().(), Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][ClampAssign]::max_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_luma().()]
228 }
229 other {white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.}
230 where T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Onerust-analyzer cargo palette 0.7.6 num/One#
231 }
232
233 impl_mixrust-analyzer cargo palette 0.7.6 macros/mix/impl_mix!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>);
234 impl_lightenrust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_lighten!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp> increase {luma => [Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][Lighten]::min_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_luma().(), Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][Lighten]::max_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_luma().()]} other {xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y.} phantom: white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point. where T: Onerust-analyzer cargo palette 0.7.6 num/One#);
235 impl_premultiplyrust-analyzer cargo palette 0.7.6 macros/blend/impl_premultiply!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp> {xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.} phantom: white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
236 impl_euclidean_distancerust-analyzer cargo palette 0.7.6 macros/color_difference/impl_euclidean_distance!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp> {xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.});
237
238 impl<Wp, T> HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask# for Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>
239 where
240 T: HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#,
241 {
242 type Maskrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][HasBoolMask]Mask# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#;
243 }
244
245 impl<Wp, T> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>
246 where
247 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero#,
248 Wp: WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#<T>,
249 Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>: IntoColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#<Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][Default]>,
250 {
251 fn defaultrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][Default]default().() -> Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T> {
252 // The default for x and y are the white point x and y ( from the default D65).
253 // Since Y (luma) is 0.0, this makes the default color black just like for
254 // other colors. The reason for not using 0 for x and y is that this
255 // outside the usual color gamut and might cause scaling issues.
256 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy# {
257 lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.: T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(),
258 ..Wp::get_xyzrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#get_xyz().().with_white_pointrust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`]with_white_point().().into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#into_color_unclamped().()
259 }
260 }
261 }
262
263 impl_color_addrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_add!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
264 impl_color_subrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_sub!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
265 impl_color_mulrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_mul!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
266 impl_color_divrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_div!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
267
268 impl_array_castsrust-analyzer cargo palette 0.7.6 macros/casting/impl_array_casts!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>, [T; 3]);
269 impl_simd_array_conversionrust-analyzer cargo palette 0.7.6 macros/simd/impl_simd_array_conversion!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [x, y, luma], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
270 impl_struct_of_array_traitsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_array_traits!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
271
272 impl_eqrust-analyzer cargo palette 0.7.6 macros/equality/impl_eq!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.]);
273 impl_copy_clonerust-analyzer cargo palette 0.7.6 macros/copy_clone/impl_copy_clone!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp>, [xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.], white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.);
274
275 #[allow(deprecated)]
276 impl<Wp, T> craterust-analyzer cargo palette 0.7.6 crate/::RelativeContrastrust-analyzer cargo palette 0.7.6 relative_contrast/RelativeContrast# for Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T>
277 where
278 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#,
279 T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T>,
280 {
281 type Scalarrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][RelativeContrast]Scalar# = T;
282
283 #[inline]
284 fn get_contrast_ratiorust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][RelativeContrast]get_contrast_ratio().(self, other: Selfrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`][RelativeContrast]) -> T {
285 craterust-analyzer cargo palette 0.7.6 crate/::contrast_ratiorust-analyzer cargo palette 0.7.6 relative_contrast/contrast_ratio().(self.lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma., other.lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.)
286 }
287 }
288
289 impl_rand_traits_cartesianrust-analyzer cargo palette 0.7.6 macros/random/impl_rand_traits_cartesian!!(UniformYxyrust-analyzer cargo palette 0.7.6 yxy/UniformYxy#, Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp> {xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.} phantom: white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.: PhantomData<Wp>);
290
291 #[cfg(feature = "bytemuck")]
292 unsafe impl<Wp, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# for Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# {}
293
294 #[cfg(feature = "bytemuck")]
295 unsafe impl<Wp: 'static, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# for Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# {}
296
297 #[cfg(test)]
298 mod testrust-analyzer cargo palette 0.7.6 yxy/test/ {
299 use superrust-analyzer cargo palette 0.7.6 yxy/::Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#;
300 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#;
301
302 test_convert_into_from_xyzrust-analyzer cargo palette 0.7.6 macros/convert/test_convert_into_from_xyz!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#);
303
304 #[cfg(feature = "approx")]
305 mod conversionrust-analyzer cargo palette 0.7.6 yxy/test/conversion/ {
306 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#, FromColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#, LinLumarust-analyzer cargo palette 0.7.6 luma/LinLuma#, LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#, Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#};
307
308 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
309 fn lumarust-analyzer cargo palette 0.7.6 yxy/test/conversion/luma().() {
310 let a = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/impl#[U][`FromColor<T>`]from_color().(LinLumarust-analyzer cargo palette 0.7.6 luma/LinLuma#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(0.5));
311 let b = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(0.312727, 0.329023, 0.5);
312 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(a, b, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.000001);
313 }
314
315 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
316 fn redrust-analyzer cargo palette 0.7.6 yxy/test/conversion/red().() {
317 let a = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::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));
318 let b = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(0.64, 0.33, 0.212673);
319 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(a, b, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.000001);
320 }
321
322 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
323 fn greenrust-analyzer cargo palette 0.7.6 yxy/test/conversion/green().() {
324 let a = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::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));
325 let b = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(0.3, 0.6, 0.715152);
326 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(a, b, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.000001);
327 }
328
329 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
330 fn bluerust-analyzer cargo palette 0.7.6 yxy/test/conversion/blue().() {
331 let a = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::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));
332 let b = Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(0.15, 0.06, 0.072175);
333 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(a, b, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.000001);
334 }
335 }
336
337 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
338 fn rangesrust-analyzer cargo palette 0.7.6 yxy/test/ranges().() {
339 assert_rangesrust-analyzer cargo palette 0.7.6 macros/clamp/assert_ranges!! {
340 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f64>;
341 clamped {
342 x: 0.0 => 1.0,
343 y: 0.0 => 1.0,
344 luma: 0.0 => 1.0
345 }
346 clamped_min {}
347 unclamped {}
348 }
349 }
350
351 raw_pixel_conversion_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_tests!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: x, y, luma);
352 raw_pixel_conversion_fail_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_fail_tests!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: x, y, luma);
353
354 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
355 fn check_min_max_componentsrust-analyzer cargo palette 0.7.6 yxy/test/check_min_max_components().() {
356 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::min_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_x().(), 0.0);
357 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::min_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_y().(), 0.0);
358 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::min_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]min_luma().(), 0.0);
359 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::max_xrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_x().(), 1.0);
360 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::max_yrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_y().(), 1.0);
361 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::max_lumarust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]max_luma().(), 1.0);
362 }
363
364 struct_of_arrays_testsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/struct_of_arrays_tests!!(
365 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>[xrust-analyzer cargo palette 0.7.6 yxy/Yxy#x., yrust-analyzer cargo palette 0.7.6 yxy/Yxy#y., lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma.] phantom: white_pointrust-analyzer cargo palette 0.7.6 yxy/Yxy#white_point.,
366 superrust-analyzer cargo palette 0.7.6 yxy/::Yxyarust-analyzer cargo palette 0.7.6 yxy/Yxya#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]new().(0.1f32, 0.2, 0.3, 0.4),
367 superrust-analyzer cargo palette 0.7.6 yxy/::Yxyarust-analyzer cargo palette 0.7.6 yxy/Yxya#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]new().(0.2, 0.3, 0.4, 0.5),
368 superrust-analyzer cargo palette 0.7.6 yxy/::Yxyarust-analyzer cargo palette 0.7.6 yxy/Yxya#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Alpha<Yxy<Wp, T>, A>`]new().(0.3, 0.4, 0.5, 0.6)
369 );
370
371 #[cfg(feature = "serializing")]
372 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
373 fn serializerust-analyzer cargo palette 0.7.6 yxy/test/serialize().() {
374 let serialized = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::to_stringrust-analyzer cargo serde_json 1.0.116 ser/to_string().(&Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(0.3, 0.8, 0.1)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
375
376 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(serialized, r#"{"x":0.3,"y":0.8,"luma":0.1}"#);
377 }
378
379 #[cfg(feature = "serializing")]
380 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
381 fn deserializerust-analyzer cargo palette 0.7.6 yxy/test/deserialize().() {
382 let deserialized: Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy# = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::from_strrust-analyzer cargo serde_json 1.0.116 de/from_str().(r#"{"x":0.3,"y":0.8,"luma":0.1}"#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
383
384 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(deserialized, Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#::newrust-analyzer cargo palette 0.7.6 yxy/impl#[`Yxy<Wp, T>`]new().(0.3, 0.8, 0.1));
385 }
386
387 test_uniform_distributionrust-analyzer cargo palette 0.7.6 macros/random/test_uniform_distribution!! {
388 Yxy<D65, f32> {
389 x: (0.0, 1.0),
390 y: (0.0, 1.0),
391 luma: (0.0, 1.0)
392 },
393 min: Yxy::new(0.0f32, 0.0, 0.0),
394 max: Yxy::new(1.0, 1.0, 1.0),
395 }
396 }