heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Compile-time operations for `LinearMap`

Open AndreiPashkin opened this issue 6 months ago • 1 comments

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?

AndreiPashkin avatar May 19 '25 22:05 AndreiPashkin

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.

sosthene-nitrokey avatar May 20 '25 11:05 sosthene-nitrokey