Closed Type1J closed 2 years ago
I've been busy so I'll look at this issue and #9 later. :slightly_smiling_face:
Really I don't think Vec
is even the right choice for what keyframe is trying to do. What I wanted was a generic version of mint::Vector2<T>
, mint::Vector3<T>
, etc. so you could tween between two arrays of the same size where all the elements are the same type. Ideally this would be checked at compile time and implemented with a generic array type ([T; N]
) but as far as I know Rust still doesn't support generic arrays, so I went with Vec<T>
and a runtime check for mismatched size.
I believe that Rust 1.51 added that feature.
Yes, this feature is called const generics. I'm considering to use this crate in a no_std
environment to implement visual effects. It would be great if it was possible to use the keyframe module in no_std
, too.
If you still need a Vec
for something, please also consider heapless::Vec
which also uses const generics for a fixed allocation with Vec
semantics.
Vec
is explicitly given attention in this crate, butsmallvec
may be a better fit for most use cases of this library, and may allow (through return value optimization) the use of this crate with aVec
-like type without allocation.