-
Notifications
You must be signed in to change notification settings - Fork 214
Description
So, a dynamically sized Vec
, but still with a max capacity. This would remain heapless, as you can construct the slice on the stack or static
and pass it in. There are some particular advantages to this approach in an embedded environment, the biggest of which being the lack of monomorphization required to support multiple capacities. A . It can also be safely produced from a SliceVec<'a, T>
with dynamic length N
can be produced via a method on &'a mut Vec<T, N>
&'a mut [MaybeUninit<T>]
and &'a mut [T]
, since we never write new uninit data.
A SliceVec
can also be used on external buffers, such as keeping track of how many bytes of an uninit buffer have been written to and provide a safe method to retrieve the initialized bytes. This is particularly useful for zero-copy deserialization.
If I were send a PR to add this, would it be accepted? This is a blocker for my team switching to heapless
off of FixedVec
, which has less support and fewer types to work with.