slice-of-array icon indicating copy to clipboard operation
slice-of-array copied to clipboard

Owned data conversions ARE possible

Open ExpHP opened this issue 5 years ago • 1 comments

The primary issue that prevented me from implementing these on Vecs was the cap field, which is not necessarily a multiple of the array length when using nest(). However, Box<[T]> and Rc<[T]> have no such problem.

Furthermore, in the current implementation of Vec, the value of the cap field is always a deterministic function of the sequence of methods called on the Vec, independent of the block sizes used by the allocator:

https://users.rust-lang.org/t/needlessly-weak-promises-on-vector-capacity/25572

However, I am not willing to provide these methods on Vec until there is a method whose documentation explicitly guarantees that it will set cap = len.

ExpHP avatar Jul 11 '19 13:07 ExpHP