pub struct DefaultVec<T, I = usize>(/* private fields */);
Expand description
A mapping from indexes to values where all indexes initially map to Default::default
It is stored in 2 usize
s worth of memory since it doesn’t need to store the length.
It resizes its heap allocation whenever an element that wouldn’t otherwise fit in memory is added and doesn’t ever shrink its memory so it could end of wasting memory if an element is added with a large index and then removed
Implementations§
Trait Implementations§
Source§impl<T, I> Default for DefaultVec<T, I>
impl<T, I> Default for DefaultVec<T, I>
Auto Trait Implementations§
impl<T, I> Freeze for DefaultVec<T, I>
impl<T, I> RefUnwindSafe for DefaultVec<T, I>where
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, I> Send for DefaultVec<T, I>
impl<T, I> Sync for DefaultVec<T, I>
impl<T, I> Unpin for DefaultVec<T, I>where
I: Unpin,
impl<T, I> UnwindSafe for DefaultVec<T, I>where
I: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more