[−][src]Trait generic_vec::raw::Storage
A type that can hold T
s, and potentially
reserve space for more Self::Items
s
Associated Constants
pub const IS_ALIGNED: bool
[src]
Is the pointer from as_ptr
guaranteed to be aligned to T
Ideally this would be a where
clause to prevent alignment issues
at compile time, but that can't happen until const-generics allows
predicates in where bounds (like where align_of::<T>() >= align_of::<U>()
)
Required methods
pub fn capacity(&self) -> usize
[src]
The number of elements that it is valid to write to this Storage
i.e. as_mut_ptr()..as_mut_ptr() + capacity()
should be valid to write
T
s
pub fn as_ptr(&self) -> *const T
[src]
Returns a pointer to the first element
pub fn as_mut_ptr(&mut self) -> *mut T
[src]
Returns a mutable pointer to the first element
pub fn reserve(&mut self, new_capacity: usize)
[src]
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
pub fn try_reserve(&mut self, new_capacity: usize) -> bool
[src]
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