Debian Codegraph @

src/lchuv.rs

raw symbols SCIP
1 //! Types for the CIE L\*C\*uv h°uv 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#, 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#};
4
5 use craterust-analyzer cargo palette 0.7.6 crate/::{
6 anglerust-analyzer cargo palette 0.7.6 angle/::RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#,
7 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#},
8 convertrust-analyzer cargo palette 0.7.6 convert/::FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#,
9 huesrust-analyzer cargo palette 0.7.6 hues/::LuvHueIterrust-analyzer cargo palette 0.7.6 hues/LuvHueIter#,
10 luv_boundsrust-analyzer cargo palette 0.7.6 luv_bounds/::LuvBoundsrust-analyzer cargo palette 0.7.6 luv_bounds/LuvBounds#,
11 numrust-analyzer cargo palette 0.7.6 num/::{Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, Hypotrust-analyzer cargo palette 0.7.6 num/Hypot#, PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#, Powirust-analyzer cargo palette 0.7.6 num/Powi#, Realrust-analyzer cargo palette 0.7.6 num/Real#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#},
12 white_pointrust-analyzer cargo palette 0.7.6 white_point/::D65rust-analyzer cargo palette 0.7.6 white_point/D65#,
13 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#, Hsluvrust-analyzer cargo palette 0.7.6 hsluv/Hsluv#, Luvrust-analyzer cargo palette 0.7.6 luv/Luv#, LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#, Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#,
14 };
15
16 /// CIE L\*C\*uv h°uv with an alpha component. See the [`Lchuva` implementation in
17 /// `Alpha`](crate::Alpha#Lchuva).
18 pub type Lchuvarust-analyzer cargo palette 0.7.6 lchuv/Lchuva#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> = Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>, T>;
19
20 /// CIE L\*C\*uv h°uv, a polar version of [CIE L\*u\*v\*](crate::Luv).
21 ///
22 /// L\*C\*uv h°uv shares its range and perceptual uniformity with L\*u\*v\*, but
23 /// it's a cylindrical color space, like [HSL](crate::Hsl) and
24 /// [HSV](crate::Hsv). This gives it the same ability to directly change
25 /// the hue and colorfulness of a color, while preserving other visual aspects.
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(Luv, Lchuv, Hsluv)
33 )]
34 #[repr(C)]
35 pub struct Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> {
36 /// L\* is the lightness of the color. 0.0 gives absolute black and 100.0
37 /// gives the brightest white.
38 pub lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l.: T,
39
40 /// C\*uv is the colorfulness of the color. It's similar to
41 /// saturation. 0.0 gives gray scale colors, and numbers around
42 /// 130-180 gives fully saturated colors, depending on the
43 /// hue. The upper limit of 180 should include the whole
44 /// L\*u\*v\*.
45 pub chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma.: T,
46
47 /// The hue of the color, in degrees. Decides if it's red, blue, purple,
48 /// etc.
49 #[paletterust-analyzer cargo palette_derive 0.7.6 palette:(unsafe_same_layout_as = "T")]
50 pub huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.: LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>,
51
52 /// The white point associated with the color's illuminant and observer.
53 /// D65 for 2 degree observer is used by default.
54 #[cfg_attr(feature = "serializing", serde(skip))]
55 #[paletterust-analyzer cargo palette_derive 0.7.6 palette:(unsafe_zero_sized)]
56 pub white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Wp>,
57 }
58
59 impl<Wp, T> Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T> {
60 /// Create a CIE L\*C\*uv h°uv color.
61 pub fn newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>>>(l: T, chroma: T, hue: H) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`] {
62 Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]::new_construst-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new_const().(l, chroma, hue.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().())
63 }
64
65 /// Create a CIE L\*C\*uv h°uv color. This is the same as `Lchuv::new`
66 /// without the generic hue type. It's temporary until `const fn` supports
67 /// traits.
68 pub const fn new_construst-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new_const().(l: T, chroma: T, hue: LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`] {
69 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv# {
70 lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l.,
71 chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma.,
72 huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.,
73 white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
74 }
75 }
76
77 /// Convert to a `(L\*, C\*uv, h°uv)` tuple.
78 pub fn into_componentsrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]into_components().(self) -> (T, T, LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>) {
79 (self.lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., self.chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma., self.huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.)
80 }
81
82 /// Convert from a `(L\*, C\*uv, h°uv)` tuple.
83 pub fn from_componentsrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]from_components().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>>>((l, chroma, hue): (T, T, H)) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`] {
84 Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().(l, chroma, hue)
85 }
86 }
87
88 impl<Wp, T> Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>
89 where
90 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Realrust-analyzer cargo palette 0.7.6 num/Real#,
91 {
92 /// Return the `l` value minimum.
93 pub fn min_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_l().() -> T {
94 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
95 }
96
97 /// Return the `l` value maximum.
98 pub fn max_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_l().() -> T {
99 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0)
100 }
101
102 /// Return the `chroma` value minimum.
103 pub fn min_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_chroma().() -> T {
104 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
105 }
106
107 /// Return the `chroma` value maximum.
108 pub fn max_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_chroma().() -> T {
109 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(180.0)
110 }
111 }
112
113 ///<span id="Lchuva"></span>[`Lchuva`](crate::Lchuva) implementations.
114 impl<Wp, T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>, A> {
115 /// Create a CIE L\*C\*uv h°uv color with transparency.
116 pub fn newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]new().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>>>(l: T, chroma: T, hue: H, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`] {
117 Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]::new_construst-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]new_const().(l, chroma, hue.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), alpha)
118 }
119
120 /// Create a CIE L\*C\*uv h°uv color with transparency. This is the same as
121 /// `Lchuva::new` without the generic hue type. It's temporary until `const
122 /// fn` supports traits.
123 pub const fn new_construst-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]new_const().(l: T, chroma: T, hue: LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`] {
124 Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# {
125 colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::new_construst-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new_const().(l, chroma, hue),
126 alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.,
127 }
128 }
129
130 /// Convert to a `(L\*, C\*uv, h°uv, alpha)` tuple.
131 pub fn into_componentsrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]into_components().(self) -> (T, T, LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>, A) {
132 (self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue., self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.)
133 }
134
135 /// Convert from a `(L\*, C\*uv, h°uv, alpha)` tuple.
136 pub fn from_componentsrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]from_components().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>>>((l, chroma, hue, alpha): (T, T, H, A)) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`] {
137 Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]new().(l, chroma, hue, alpha)
138 }
139 }
140
141 impl_reference_component_methods_huerust-analyzer cargo palette 0.7.6 macros/reference_component/impl_reference_component_methods_hue!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, [lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma.], white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
142 impl_struct_of_arrays_methods_huerust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_arrays_methods_hue!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, [l, chroma], white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
143
144 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 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T> {
145 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`FromColorUnclamped<Self>`]from_color_unclamped().(color: Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`FromColorUnclamped<Self>`] {
146 color
147 }
148 }
149
150 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 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>
151 where
152 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Hypotrust-analyzer cargo palette 0.7.6 num/Hypot#,
153 Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>: GetHuerust-analyzer cargo palette 0.7.6 GetHue#<Huerust-analyzer cargo palette 0.7.6 GetHue#Hue# = LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>>,
154 {
155 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`FromColorUnclamped<Luv<Wp, T>>`]from_color_unclamped().(color: Luvrust-analyzer cargo palette 0.7.6 luv/Luv#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`FromColorUnclamped<Luv<Wp, T>>`] {
156 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv# {
157 huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.: color.get_huerust-analyzer cargo palette 0.7.6 GetHue#get_hue().(),
158 lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l.: color.lrust-analyzer cargo palette 0.7.6 luv/Luv#l.,
159 chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma.: color.urust-analyzer cargo palette 0.7.6 luv/Luv#u..hypotrust-analyzer cargo palette 0.7.6 num/Hypot#hypot().(color.vrust-analyzer cargo palette 0.7.6 luv/Luv#v.),
160 white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
161 }
162 }
163 }
164
165 impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Hsluvrust-analyzer cargo palette 0.7.6 hsluv/Hsluv#<Wp, T>> for Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>
166 where
167 T: Realrust-analyzer cargo palette 0.7.6 num/Real# + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# + Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<f64> + Powirust-analyzer cargo palette 0.7.6 num/Powi# + 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#,
168 {
169 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`FromColorUnclamped<Hsluv<Wp, T>>`]from_color_unclamped().(color: Hsluvrust-analyzer cargo palette 0.7.6 hsluv/Hsluv#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`FromColorUnclamped<Hsluv<Wp, T>>`] {
170 // Apply the given saturation as a percentage of the max
171 // chroma for that hue.
172 let max_chroma =
173 LuvBoundsrust-analyzer cargo palette 0.7.6 luv_bounds/LuvBounds#::from_lightnessrust-analyzer cargo palette 0.7.6 luv_bounds/impl#[LuvBounds]from_lightness().(color.lrust-analyzer cargo palette 0.7.6 hsluv/Hsluv#l..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()).max_chroma_at_huerust-analyzer cargo palette 0.7.6 luv_bounds/impl#[LuvBounds]max_chroma_at_hue().(color.huerust-analyzer cargo palette 0.7.6 hsluv/Hsluv#hue..clonerust-analyzer cargo palette 0.7.6 hues/impl#[`LuvHue<T>`][Clone]clone().());
174
175 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().(
176 color.lrust-analyzer cargo palette 0.7.6 hsluv/Hsluv#l.,
177 color.saturationrust-analyzer cargo palette 0.7.6 hsluv/Hsluv#saturation. 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().max_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().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.01),
178 color.huerust-analyzer cargo palette 0.7.6 hsluv/Hsluv#hue.,
179 )
180 }
181 }
182
183 impl_tuple_conversion_huerust-analyzer cargo palette 0.7.6 macros/convert/impl_tuple_conversion_hue!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp> as (T, T, H), LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#);
184
185 impl_is_within_boundsrust-analyzer cargo palette 0.7.6 macros/clamp/impl_is_within_bounds!! {
186 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp> {
187 lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l. => [Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][IsWithinBounds]::min_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][IsWithinBounds]::max_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_l().()],
188 chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma. => [Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][IsWithinBounds]::min_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_chroma().(), Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][IsWithinBounds]::max_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_chroma().()]
189 }
190 where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
191 }
192 impl_clamprust-analyzer cargo palette 0.7.6 macros/clamp/impl_clamp!! {
193 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp> {
194 lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l. => [Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][ClampAssign]::min_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][ClampAssign]::max_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_l().()],
195 chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma. => [Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][ClampAssign]::min_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_chroma().(), Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][ClampAssign]::max_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_chroma().()]
196 }
197 other {huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue., white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.}
198 where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
199 }
200
201 impl_mix_huerust-analyzer cargo palette 0.7.6 macros/mix/impl_mix_hue!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp> {l, chroma} phantom: white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
202 impl_lightenrust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_lighten!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp> increase {l => [Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][Lighten]::min_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][Lighten]::max_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_l().()]} other {huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma.} phantom: white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
203 impl_saturaterust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_saturate!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp> increase {chroma => [Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][Saturate]::min_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_chroma().(), Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][Saturate]::max_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_chroma().()]} other {huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue., lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l.} phantom: white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
204 impl_hue_opsrust-analyzer cargo palette 0.7.6 macros/hue/impl_hue_ops!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#);
205
206 impl<Wp, T> HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask# for Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>
207 where
208 T: HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#,
209 {
210 type Maskrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][HasBoolMask]Mask# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#;
211 }
212
213 impl<Wp, T> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>
214 where
215 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Realrust-analyzer cargo palette 0.7.6 num/Real#,
216 LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#<T>: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#,
217 {
218 fn defaultrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][Default]default().() -> Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T> {
219 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().(Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][Default]::min_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][Default]::min_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_chroma().(), LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().())
220 }
221 }
222
223 impl_color_addrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_add!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, [lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma., huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.], white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
224 impl_color_subrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_sub!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, [lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma., huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.], white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
225
226 impl_array_castsrust-analyzer cargo palette 0.7.6 macros/casting/impl_array_casts!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>, [T; 3]);
227 impl_simd_array_conversion_huerust-analyzer cargo palette 0.7.6 macros/simd/impl_simd_array_conversion_hue!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, [l, chroma], white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
228 impl_struct_of_array_traits_huerust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_array_traits_hue!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, LuvHueIterrust-analyzer cargo palette 0.7.6 hues/LuvHueIter#, [lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma.], white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
229
230 impl_eq_huerust-analyzer cargo palette 0.7.6 macros/equality/impl_eq_hue!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#, [lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma., huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.]);
231 impl_copy_clonerust-analyzer cargo palette 0.7.6 macros/copy_clone/impl_copy_clone!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp>, [lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma., huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.], white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.);
232
233 #[allow(deprecated)]
234 impl<Wp, T> craterust-analyzer cargo palette 0.7.6 crate/::RelativeContrastrust-analyzer cargo palette 0.7.6 relative_contrast/RelativeContrast# for Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T>
235 where
236 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#,
237 T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T>,
238 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 lchuv/impl#[`Lchuv<Wp, T>`][RelativeContrast]>,
239 {
240 type Scalarrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][RelativeContrast]Scalar# = T;
241
242 #[inline]
243 fn get_contrast_ratiorust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][RelativeContrast]get_contrast_ratio().(self, other: Selfrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][RelativeContrast]) -> T {
244 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);
245 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);
246
247 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.)
248 }
249 }
250
251 impl_rand_traits_cylinderrust-analyzer cargo palette 0.7.6 macros/random/impl_rand_traits_cylinder!!(
252 UniformLchuvrust-analyzer cargo palette 0.7.6 lchuv/UniformLchuv#,
253 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp> {
254 hue: UniformLuvHuerust-analyzer cargo palette 0.7.6 hues/UniformLuvHue# => LuvHuerust-analyzer cargo palette 0.7.6 hues/LuvHue#,
255 height: lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l. => [|l: T| l *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<Wp, T>::max_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_l().()],
256 radius: chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma. => [|chroma| chroma *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<Wp, T>::max_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_chroma().()]
257 }
258 phantom: white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.: PhantomData<Wp>
259 where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero# + 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>,
260 );
261
262 #[cfg(feature = "bytemuck")]
263 unsafe impl<Wp, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# for Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# {}
264
265 #[cfg(feature = "bytemuck")]
266 unsafe impl<Wp: 'static, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# for Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# {}
267
268 #[cfg(test)]
269 mod testrust-analyzer cargo palette 0.7.6 lchuv/test/ {
270 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#;
271 use craterust-analyzer cargo palette 0.7.6 crate/::Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#;
272
273 test_convert_into_from_xyzrust-analyzer cargo palette 0.7.6 macros/convert/test_convert_into_from_xyz!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#);
274
275 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
276 fn rangesrust-analyzer cargo palette 0.7.6 lchuv/test/ranges().() {
277 assert_rangesrust-analyzer cargo palette 0.7.6 macros/clamp/assert_ranges!! {
278 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f64>;
279 clamped {
280 l: 0.0 => 100.0,
281 chroma: 0.0 => 180.0
282 }
283 clamped_min {
284 }
285 unclamped {
286 hue: -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().360.0 => 360.0
287 }
288 }
289 }
290
291 /// Check that the arithmetic operations (add/sub) are all
292 /// implemented.
293 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
294 fn test_arithmeticrust-analyzer cargo palette 0.7.6 lchuv/test/test_arithmetic().() {
295 let lchuv = Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().(120.0, 40.0, 30.0);
296 let lchuv2 = Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().(200.0, 30.0, 40.0);
297 let mut _lchuv3 = lchuv rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Add<Self>`]add().+rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Add<Self>`]add(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Add<Self>`]add().lchuv2;
298 _lchuv3 rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`AddAssign<Self>`]add_assign(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`AddAssign<Self>`]add_assign().lchuv2;
299 let mut _lchuv4 = lchuv2 rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Add<T>`]add().+rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Add<T>`]add(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Add<T>`]add().0.3;
300 _lchuv4 rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`AddAssign<T>`]add_assign().+=rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`AddAssign<T>`]add_assign(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`AddAssign<T>`]add_assign().0.1;
301
302 _lchuv3 = lchuv2 rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Sub<Self>`]sub().-rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Sub<Self>`]sub(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Sub<Self>`]sub().lchuv;
303 _lchuv3 = _lchuv4 rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Sub<T>`]sub().-rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Sub<T>`]sub(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`Sub<T>`]sub().0.1;
304 _lchuv4 rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`SubAssign<Self>`]sub_assign()._lchuv3;
305 _lchuv3 rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`SubAssign<T>`]sub_assign().-=rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`SubAssign<T>`]sub_assign(). rust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`][`SubAssign<T>`]sub_assign().0.1;
306 }
307
308 raw_pixel_conversion_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_tests!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: l, chroma, hue);
309 raw_pixel_conversion_fail_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_fail_tests!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: l, chroma, hue);
310
311 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
312 fn check_min_max_componentsrust-analyzer cargo palette 0.7.6 lchuv/test/check_min_max_components().() {
313 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_l().(), 0.0);
314 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_lrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_l().(), 100.0);
315 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]min_chroma().(), 0.0);
316 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_chromarust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]max_chroma().(), 180.0);
317 }
318
319 struct_of_arrays_testsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/struct_of_arrays_tests!!(
320 Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>[lrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#l., chromarust-analyzer cargo palette 0.7.6 lchuv/Lchuv#chroma., huerust-analyzer cargo palette 0.7.6 lchuv/Lchuv#hue.] phantom: white_pointrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#white_point.,
321 superrust-analyzer cargo palette 0.7.6 lchuv/::Lchuvarust-analyzer cargo palette 0.7.6 lchuv/Lchuva#::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]new().(0.1f32, 0.2, 0.3, 0.4),
322 superrust-analyzer cargo palette 0.7.6 lchuv/::Lchuvarust-analyzer cargo palette 0.7.6 lchuv/Lchuva#::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]new().(0.2, 0.3, 0.4, 0.5),
323 superrust-analyzer cargo palette 0.7.6 lchuv/::Lchuvarust-analyzer cargo palette 0.7.6 lchuv/Lchuva#::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Alpha<Lchuv<Wp, T>, A>`]new().(0.3, 0.4, 0.5, 0.6)
324 );
325
326 #[cfg(feature = "serializing")]
327 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
328 fn serializerust-analyzer cargo palette 0.7.6 lchuv/test/serialize().() {
329 let serialized = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::to_stringrust-analyzer cargo serde_json 1.0.116 ser/to_string().(&Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().(80.0, 70.0, 130.0)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
330
331 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(serialized, r#"{"l":80.0,"chroma":70.0,"hue":130.0}"#);
332 }
333
334 #[cfg(feature = "serializing")]
335 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
336 fn deserializerust-analyzer cargo palette 0.7.6 lchuv/test/deserialize().() {
337 let deserialized: Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv# =
338 ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::from_strrust-analyzer cargo serde_json 1.0.116 de/from_str().(r#"{"l":70.0,"chroma":80.0,"hue":130.0}"#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
339
340 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(deserialized, Lchuvrust-analyzer cargo palette 0.7.6 lchuv/Lchuv#::newrust-analyzer cargo palette 0.7.6 lchuv/impl#[`Lchuv<Wp, T>`]new().(70.0, 80.0, 130.0));
341 }
342
343 test_uniform_distributionrust-analyzer cargo palette 0.7.6 macros/random/test_uniform_distribution!! {
344 Lchuv<D65, f32> as crate::Luv {
345 l: (0.0, 100.0),
346 u: (-80.0, 80.0),
347 v: (-80.0, 80.0),
348 },
349 min: Lchuv::new(0.0f32, 0.0, 0.0),
350 max: Lchuv::new(100.0, 180.0, 360.0)
351 }
352 }