Trait cl_generic_vec::raw::Storage [−][src]
pub unsafe trait Storage: AsRef<[MaybeUninit<Self::Item>]> + AsMut<[MaybeUninit<Self::Item>]> {
type Item;
fn reserve(&mut self, new_capacity: usize);
fn try_reserve(&mut self, new_capacity: usize) -> AllocResult;
}
Expand description
A type that can hold T
s, and potentially
reserve space for more Self::Items
s
Safety
Other safe types rely on this trait being implemented correctly. See the safety requirements on each function
Associated Types
Required methods
Reserves space for at least new_capacity
elements
Safety
After this call successfully ends, the capacity
must be at least
new_capacity
Panic/Abort
Maybe panic or abort if it is impossible to set the capacity
to at
least new_capacity
fn try_reserve(&mut self, new_capacity: usize) -> AllocResult
fn try_reserve(&mut self, new_capacity: usize) -> AllocResult
Tries to reserve space for at least new_capacity
elements
Returns Ok(())
on success, Err(AllocError)
if it is impossible to
set the capacity
to at least new_capacity
Safety
If Ok(())
is returned, the capacity
must be at least new_capacity