Closed okaneco closed 1 year ago
That could be useful in general! Especially if it should branch off as its own crate.
The traits as they are are currently added as I need them, so it's far from a "complete" math trait library. More of a proof of concept, so it's still a bit minimal. For now, the work-around is for the caller to add additional bounds and maybe use num_traits
if that's fine.
Thinking a bit more about it, I don't think this trait should be added unless Palette needs it. It's not based on any traits that only exist in Palette and it has the negative property of being impossible to extend without making a breaking change, so it goes against what I would like the palette::num
traits to be. If I break that module off, the Arithmetics
trait should either stay in Palette as a laziness helper or be removed. It's simple to create local versions of it, though, or it could be material for a separate crate.
I've started porting my crates to
0.7
and this seemed like a small gap in convenience.I had to rewrite a few places where I was summing individual components.
I'd like to see a trait where all the
num::Arithmetics
operations'Assignable
variants are implemented.