Debian Codegraph @

src/okhsv/visual_eq.rs

raw symbols SCIP
1 use craterust-analyzer cargo palette 0.7.6 crate/::anglerust-analyzer cargo palette 0.7.6 angle/::{AngleEqrust-analyzer cargo palette 0.7.6 angle/AngleEq#, HalfRotationrust-analyzer cargo palette 0.7.6 angle/HalfRotation#, RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#, SignedAnglerust-analyzer cargo palette 0.7.6 angle/SignedAngle#};
2 use craterust-analyzer cargo palette 0.7.6 crate/::numrust-analyzer cargo palette 0.7.6 num/::{Onerust-analyzer cargo palette 0.7.6 num/One#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#};
3 use craterust-analyzer cargo palette 0.7.6 crate/::visualrust-analyzer cargo palette 0.7.6 visual/::{VisualColorrust-analyzer cargo palette 0.7.6 visual/VisualColor#, VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#};
4 use craterust-analyzer cargo palette 0.7.6 crate/::{HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, Okhsvrust-analyzer cargo palette 0.7.6 okhsv/Okhsv#, OklabHuerust-analyzer cargo palette 0.7.6 hues/OklabHue#};
5 use approxrust-analyzer cargo approx 0.5.1 crate/::AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#;
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std 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#, Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#, Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#};
8
9 impl<T> VisualColorrust-analyzer cargo palette 0.7.6 visual/VisualColor#<T> for Okhsvrust-analyzer cargo palette 0.7.6 okhsv/Okhsv#<T>
10 where
11 T: PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#
12 + HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool>
13 + AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#<Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon# = T>
14 + Onerust-analyzer cargo palette 0.7.6 num/One#
15 + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
16 + 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>,
17 T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
18 OklabHuerust-analyzer cargo palette 0.7.6 hues/OklabHue#<T>: AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#<Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon# = T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#>,
19 {
20 /// Returns true, if `saturation == 0`
21 fn is_greyrust-analyzer cargo palette 0.7.6 okhsv/visual_eq/impl#[`Okhsv<T>`][`VisualColor<T>`]is_grey().(&self, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
22 self.saturationrust-analyzer cargo palette 0.7.6 okhsv/Okhsv#saturation..abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), epsilon)
23 }
24
25 /// Returns true, if `Self::is_grey` && `value >= 1`,
26 /// i.e. the color's hue is irrelevant **and** it is at or beyond the
27 /// `sRGB` maximum brightness. A color at or beyond maximum brightness isn't
28 /// necessarily white. It can also be a bright shining hue.
29 fn is_whiterust-analyzer cargo palette 0.7.6 okhsv/visual_eq/impl#[`Okhsv<T>`][`VisualColor<T>`]is_white().(&self, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
30 self.is_greyrust-analyzer cargo palette 0.7.6 okhsv/visual_eq/impl#[`Okhsv<T>`][`VisualColor<T>`]is_grey().(epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) && self.valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().T::onerust-analyzer cargo palette 0.7.6 num/One#one().()
31 || self.valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value..abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&T::onerust-analyzer cargo palette 0.7.6 num/One#one().(), epsilon)
32 }
33
34 /// Returns true if `value == 0`
35 fn is_blackrust-analyzer cargo palette 0.7.6 okhsv/visual_eq/impl#[`Okhsv<T>`][`VisualColor<T>`]is_black().(&self, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
36 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(self.valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value. >= -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#neg().epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().());
37 self.valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value..abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), epsilon)
38 }
39 }
40
41 impl<S, O, T> VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#<O, S, T> for Okhsvrust-analyzer cargo palette 0.7.6 okhsv/Okhsv#<T>
42 where
43 T: PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#
44 + HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool>
45 + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#
46 + SignedAnglerust-analyzer cargo palette 0.7.6 angle/SignedAngle#
47 + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
48 + Onerust-analyzer cargo palette 0.7.6 num/One#
49 + AngleEqrust-analyzer cargo palette 0.7.6 angle/AngleEq#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool>
50 + 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>
51 + AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#<Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon# = T>
52 + 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>
53 + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
54 T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + HalfRotationrust-analyzer cargo palette 0.7.6 angle/HalfRotation# + 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::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#>,
55 S: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Selfrust-analyzer cargo palette 0.7.6 okhsv/visual_eq/impl#[`Okhsv<T>`][`VisuallyEqual<O, S, T>`]> + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#,
56 O: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Selfrust-analyzer cargo palette 0.7.6 okhsv/visual_eq/impl#[`Okhsv<T>`][`VisuallyEqual<O, S, T>`]> + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#,
57 {
58 fn visually_eqrust-analyzer cargo palette 0.7.6 okhsv/visual_eq/impl#[`Okhsv<T>`][`VisuallyEqual<O, S, T>`]visually_eq().(s: S, o: O, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
59 VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#::both_black_or_both_whiterust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#both_black_or_both_white().(s, o, epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
60 || VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#::both_greyscalerust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#both_greyscale().(s, o, epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
61 && s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().()
62 .valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value.
63 .abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value., epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
64 || s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().huerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#hue..abs_diff_eqrust-analyzer cargo palette 0.7.6 hues/impl#[`OklabHue<T>`][`AbsDiffEq<Self>`]abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().huerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#hue., epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
65 && s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().()
66 .saturationrust-analyzer cargo palette 0.7.6 okhsv/Okhsv#saturation.
67 .abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().saturationrust-analyzer cargo palette 0.7.6 okhsv/Okhsv#saturation., epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
68 && s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value..abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().valuerust-analyzer cargo palette 0.7.6 okhsv/Okhsv#value., epsilon)
69 }
70 }