heapless
heapless copied to clipboard
Compile-time operations for `LinearMap`
I think it should be possible to make operations like lookups, inserts, and construction with data work at compile time for LinearMap, I wonder how open the maintainers would be to such contributions?
I don't think you could. LinearMap goes through a Vec and Vec uses BorrowMut for its internal buffer.
Until there's a way to have const fn in traits, you won't be able to do this.
Maybe it was possible before the View types were added though.
Maybe it can still be done by adding const unsafe fn from_raw([MaybeUninint<T>; N]) to Vec and way to convert a vec to a LinearMap if you absolutely need the const.