Closed Tnze closed 1 year ago
Or impl TryFrom<Vec> for Array
?
I noticed that the previous
Allocator
support made the code no longer elegant and I'm sorry for that.
I honestly don't find it that bad. I can probably even make it smaller again, but I do agree it's a bit less elegant.
This feature actually already exists: from_flattened
and into_flattened
provide exactly this functionality.
However, I just noticed with great horror that the from_flattened method is unsafe and not marked as such because it violates a guarantee that the vec has the right length. I will fix this ASAP.
BTW, do you have an account on Discord or something similar, for example? I think talking there would be more efficient than here due to me not checking this very often.
Anyways: the unsafety is now fixed in 0.6.0.
Previously, I made several requests to add more initialization methods. But now I found that I need more.
I noticed that the previous
Allocator
support made the code no longer elegant and I'm sorry for that.I have a new idea that we can provide these two method for initialize the
Array
:Due to the various initialization methods included in
Vec
, as long as data is allowed to be initialized fromVec
, we can directly utilize all the currently available methods forVec
.I also suggest removing some of the previous APIs as soon as possible and upgrading the main version number before more users use them, to improve the maintainability of the library.