Closed tarcieri closed 3 years ago
It'd also be good to address #57.
Perhaps it would make sense to implement the functionality in terms of an F32
newtype, keeping the current F32Ext
trait, but making the trait a wrapper for the newtype.
2.0 was released in #87
Since the
vector
feature usesgeneric-array
, I thought I'd take a look at porting it over to const generics now that Rust 1.51 stabilizedmin_const_generics
.It seems given the current way the vector types are structured, that isn't possible as the axes are defined using an associated type and support for generic parameters requires
const_generics
, notmin_const_generics
.However, I'm also noticing the way the vector types are implemented is... not great.
I do still like the use of discrete
x
,y
(and for 3D vectors,z
) coordinates which more or less follows existing Rust embedded conventions. However these are defined using macros with separate structs for each type, as opposed to making the coordinates generic.I think perhaps by refactoring to make the coordinates generic, and reducing the trait portion to just the functionality shared by 2D and 3D vectors, it's possible const generics won't be needed at all.