Tracking: `num-traits` support
virtualritz opened this issue · 6 comments
A user of my uniform-cubic-splines
crate wanted to use it with ultraviolet
and ran into a traits issue.
My crate relies on Zero
/One
traits. Those were removed from std::num
(unfortunately, I think), in 2014. My crate uses num-traits::Zero
/One
.
That means if some third party crate that implements a type that someone wants to use with my crate does not implement the num-traits
version of these traits, it won't work. A user can't add support for it on their side (and neither can even my crate) because of orphan rules.
I guess the only solution would be to add support for this to ultraviolet
. FYI, cgmath
, glam
& nalgebra
all support these.
Would you consider this at all (or a PR)?
Yeah absolutely. Can just make it an optional dependency and put the implementation under that feature flag :)
Only reason it hasn't been done already is I haven't needed it and nobody else has implemented it :P
Okidoki. I'll look into it soon.
Would you like the trait impl
s to live in their own file, e.g. src/vec/traits.rs
or in each existing src/vec/vec?.rs
file resp.?
I think separate file is probably best
Shall we keep this open to track further num-traits
trait impl
s?
Sure :)