Open Oppen opened 5 months ago
I'm open to exposing more low-level methods in principle. However, we need to be very careful in cases where ecow needs extra guarantees. Especially things like set_len
which require the user to reason about the internal state of the Vec
are a bit trickier since the EcoVec
may perform clone-on-write, which for instance can change its capacity. Regarding the other mentioned one: I can't find an assume_init
method for std::vec::Vec
.
assume_init
is part of MaybeUninit
, more related to the Arc
-like characteristics. I guess with set_len
and by using the spare capacity you get equivalent dynamics as with assume_init
in an uninitialized slice.
I'm not yet entirely sure how the assume_init
thing would look like. But it's also nightly-only in Rust, so maybe a bit early.
It would be nice if the API mapped closer to
std::Vec
. Methods likeassume_init
orset_len
or the ability to use custom allocators are used in a project for whichEcoVec
is otherwise a perfect fit to reduce memory fragmentation.