pub struct SameVec<T> { /* private fields */ }
Expand description
A dynamically sized buffer for types with the same layout.
Implementations§
Source§impl<T> SameVec<T>
impl<T> SameVec<T>
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a buffer with a pre-defined capacity.
This buffer will not need to reallocate until the element count required for any temporary vector exceeds this number of elements.
Sourcepub fn use_for<U>(&mut self, marker: SameLayout<T, U>) -> TempVec<'_, U>
pub fn use_for<U>(&mut self, marker: SameLayout<T, U>) -> TempVec<'_, U>
Use the allocated buffer for a compatible type of elements.
When the temporary view is dropped the allocation is returned to the buffer. This means its capacity might be automatically increased, or decreased, based on the used of the vector.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SameVec<T>
impl<T> RefUnwindSafe for SameVec<T>where
T: RefUnwindSafe,
impl<T> Send for SameVec<T>where
T: Send,
impl<T> Sync for SameVec<T>where
T: Sync,
impl<T> Unpin for SameVec<T>where
T: Unpin,
impl<T> UnwindSafe for SameVec<T>where
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