Closed RRRadicalEdward closed 4 months ago
There's no standard trait for checked operations, so unfortunately this will be pretty verbose and always incomplete.
I'm not sure if it's worth it over using .map().
I understand your point. Yes, there are no traits for checked operations, but I feel as if the RGB
types behave like primitive types from std, most of which have checked_add
/checked_sub
functions so It makes sense for RGB<u8>
, RGB<u16>
, RGB<u32>
, etc to have it as well whatever there's a trait or not for it because it mimics the std.
This PR adds
RGB::checked_add
andRGB::checked_sub
method. Do I need to add the methods for other pixels types (RGBA
, etc)?