pub fn allocate_array<T: Default>(&mut self, count: usize) -> Option<&'heap mut [T]> {
        self.allocate(mem::size_of::<T>() * count).map(|m| unsafe {
            let array: &'heap mut [T] = slice::from_raw_parts_mut(mem::transmute(m.inner().as_mut_ptr()), count);
            for item in array.iter_mut() {
                *item = T::default();
            }
            array
        })
    }
/// Request enough memory to hold an array of `count` objects of type `T`.
/// Each object in the array will be initialized to its default value.
/// Returns `None` if a block of memory that big isn't available.
Request enough memory to hold an array of `count` objects of type `T`.
Each object in the array will be initialized to its default value.
Returns `None` if a block of memory that big isn't available.
Request enough memory to hold an array of ` count ` objects of type ` T ` . Each object in the array will be initialized to its default value . Returns ` None ` if a block of memory that big isn ' t available .
pub fn allocate_array<T: Default>(&mut self, count: usize) -> Option<&'heap mut [T]> {
        self.allocate(mem::size_of::<T>() * count).map(|m| unsafe {
            let array: &'heap mut [T] = slice::from_raw_parts_mut(mem::transmute(m.inner().as_mut_ptr()), count);
            for item in array.iter_mut() {
                *item = T::default();
            }
            array
        })
    }
pub fn allocate_array < T : Default > ( & mut self , count : usize ) -> Option < & ' heap mut [ T ] > { self . allocate ( mem :: size_of :: < T > ( ) * count ) . map ( | m | unsafe { let array : & ' heap mut [ T ] = slice :: from_raw_parts_mut ( mem :: transmute ( m . inner ( ) . as_mut_ptr ( ) ) , count ) ; for item in array . iter_mut ( ) { * item = T :: default ( ) ; } array } ) }
Request enough memory to hold an array of `count` objects of type `T`.
Request enough memory to hold an array of ` count ` objects of type ` T ` .
&mut self
count
usize
&mut self
count
usize