Struct containers::collections::RawVec [−][src]
pub struct RawVec<T, A: Alloc = NullAllocator> { /* fields omitted */ }
Raw growable array, a low-level utility type to allocate a buffer of memory and not need to worry about edge cases
It never inspects the memory it holds; it merely allocates enough memory to hold however many elements, and deallocates on drop
but not drop
s its contents.
Methods
impl<T, A: Alloc> RawVec<T, A>
[src]
impl<T, A: Alloc> RawVec<T, A>
pub fn new_in(a: A) -> Self
[src]
pub fn new_in(a: A) -> Self
Make a new array.
pub fn with_capacity_in(a: A, cap: usize) -> Option<Self>
[src]
pub fn with_capacity_in(a: A, cap: usize) -> Option<Self>
Make a new array with enough room to hold at least cap
elements.
Failures
Returns None
if allocation fails.
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
Return number of elements array can hold before reallocation.
pub unsafe fn storage_mut(&mut self) -> &mut [T]
[src]
pub unsafe fn storage_mut(&mut self) -> &mut [T]
pub unsafe fn storage(&self) -> &[T]
[src]
pub unsafe fn storage(&self) -> &[T]
pub fn ptr(&self) -> *mut T
[src]
pub fn ptr(&self) -> *mut T
pub fn reserve(&mut self, n: usize, n_more: usize) -> bool
[src]
pub fn reserve(&mut self, n: usize, n_more: usize) -> bool
Make sure the array has enough room for at least n_more
more elements, assuming it
already holds n
, reallocating if need be.
Failures
Returns false
if allocation fails, true
otherwise.
pub fn relinquish(&mut self, n: usize) -> bool
[src]
pub fn relinquish(&mut self, n: usize) -> bool
Relinquish memory so capacity = n
.
pub fn grow(&mut self, cap: usize) -> bool
[src]
pub fn grow(&mut self, cap: usize) -> bool
pub unsafe fn from_raw_parts_in(alloc: A, ptr: *mut T, cap: usize) -> Self
[src]
pub unsafe fn from_raw_parts_in(alloc: A, ptr: *mut T, cap: usize) -> Self
impl<'a, T> RawVec<T, FixedStorage<'a, T>>
[src]
impl<'a, T> RawVec<T, FixedStorage<'a, T>>
pub fn from_storage(xs: &'a mut [Slot<T>]) -> Self
[src]
pub fn from_storage(xs: &'a mut [Slot<T>]) -> Self
impl<'a, T: 'a> RawVec<T, FixedStorage<'a, T>>
[src]
impl<'a, T: 'a> RawVec<T, FixedStorage<'a, T>>
pub const empty: Self
empty: Self = RawVec{ptr: <Unique>::empty(), cap: 0, alloc: FixedStorage(PhantomData),}
impl<T, A: Alloc + Default> RawVec<T, A>
[src]
impl<T, A: Alloc + Default> RawVec<T, A>
pub fn new() -> Self
[src]
pub fn new() -> Self
Make a new array.
pub unsafe fn from_raw_parts(ptr: *mut T, cap: usize) -> Self
[src]
pub unsafe fn from_raw_parts(ptr: *mut T, cap: usize) -> Self
Trait Implementations
impl<T, A: Alloc> Drop for RawVec<T, A>
[src]
impl<T, A: Alloc> Drop for RawVec<T, A>
impl<T, A: Alloc + Default> Default for RawVec<T, A>
[src]
impl<T, A: Alloc + Default> Default for RawVec<T, A>