You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not managing the allocation within FixedVec makes some rather outlandish interfaces necessary but also possible. Each should get forked into a separate issue when it gets a better draft or is being worked on. This is a quick sketch/wish list.
fn FixedVec::extend_from_within(&mut self, idx: impl SliceIndex<[T]>) fn FixedVec::fill_from_within(&mut self, f: impl FnOnce(&[T]) -> impl Iterator<Item=T>)
The elements can be borrowed when extend the FixedVec as we never have to relocate them. That's quite awesome.
Drain::skip(&mut self). Move an element to the start, then advance over it as if it were not part of the original drain(..) invocation. This would be a useful precursor to DrainFilter as well. An symmetric operation may put it in-front of the tail but needs some naming discussion (skip_back is confusing when double ended iterator should provide the same for the other side).
structSpliceVec<'a,T>{// A vector view on the contents but forgotten instead of dropped.vec:ManuallyDrop<FixedVec<'a,T>>,// Unused tail and capacity of the underlying vec.tail_len:usize,tail_capacity:usize,}impl<T>FixedVec<'_,T>{
splice_vec(&mutself) -> SpliceVec<'_,T>;}impl<'a,T> DerefforSpliceVec<'a,T>{typeTarget = FixedVec<'a,T>;// ..}
A splice that works strictly in-place. The elements in the tail of the original FixedVec may be manually shifted backwards to provide more capacity to the splice. No more work is involved exactly if the vector within the Splice is empty when it is dropped.
Not managing the allocation within
FixedVecmakes some rather outlandish interfaces necessary but also possible. Each should get forked into a separate issue when it gets a better draft or is being worked on. This is a quick sketch/wish list.(closed in FixedVec drain can implement DoubleEndedIterator #19)impl<T> DoubleEndedIterator for Drain<'_, T> { }fn FixedVec::extend_from_within(&mut self, idx: impl SliceIndex<[T]>)fn FixedVec::fill_from_within(&mut self, f: impl FnOnce(&[T]) -> impl Iterator<Item=T>)The elements can be borrowed when extend the
FixedVecas we never have to relocate them. That's quite awesome.Drain::skip(&mut self). Move an element to the start, then advance over it as if it were not part of the originaldrain(..)invocation. This would be a useful precursor toDrainFilteras well. An symmetric operation may put it in-front of the tail but needs some naming discussion (skip_backis confusing when double ended iterator should provide the same for the other side).A splice that works strictly in-place. The elements in the tail of the original
FixedVecmay be manually shifted backwards to provide more capacity to the splice. No more work is involved exactly if the vector within theSpliceis empty when it is dropped.