You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thread 'main' panicked at 'attempt to add with overflow', /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0\library\core\src\ops\arith.rs:110:1
So the feature I would find useful, which does exist for integers, is saturating_add/saturating_sub.
This would make it much easier to blend integer colors.
Description
Add two functions that make it easier to blend color:
Color::saturating_add(rhs: Color) -> Color
Color::saturating_sub(rhs: Color) -> Color
Motivation
The behavior of
Add
/AddAssign
is equal to that of integers - they can overflow, which creates a panic in debug mode.Like this:
So the feature I would find useful, which does exist for integers, is
saturating_add
/saturating_sub
.This would make it much easier to blend integer colors.
The text was updated successfully, but these errors were encountered: