unsafe fn realloc_exact(&mut self, count: usize) {
        if mem::size_of::<T>() == 0 {
            return;
        }
        if count == self.cap {
            return;
        }
        let old_layout = Self::get_layout(self.cap);
        let new_layout = Self::get_layout(count);
        let bytes_ptr = realloc(self.ptr.as_ptr() as *mut u8, old_layout, new_layout.size());
        let ptr = utils::set_ptr_value_mut(self.ptr.as_ptr(), bytes_ptr);
        self.ptr = NonNull::new(ptr).unwrap();
        self.cap = count;
    }
/// Reallocate so that the vector has the exact requested capacity
/// unsafe because the new capacity may be less than self.len
Reallocate so that the vector has the exact requested capacity
unsafe because the new capacity may be less than self.len
Reallocate so that the vector has the exact requested capacity unsafe because the new capacity may be less than self . len
unsafe fn realloc_exact(&mut self, count: usize) {
        if mem::size_of::<T>() == 0 {
            return;
        }
        if count == self.cap {
            return;
        }
        let old_layout = Self::get_layout(self.cap);
        let new_layout = Self::get_layout(count);
        let bytes_ptr = realloc(self.ptr.as_ptr() as *mut u8, old_layout, new_layout.size());
        let ptr = utils::set_ptr_value_mut(self.ptr.as_ptr(), bytes_ptr);
        self.ptr = NonNull::new(ptr).unwrap();
        self.cap = count;
    }
unsafe fn realloc_exact ( & mut self , count : usize ) { if mem :: size_of :: < T > ( ) == 0 { return ; } if count == self . cap { return ; } let old_layout = Self :: get_layout ( self . cap ) ; let new_layout = Self :: get_layout ( count ) ; let bytes_ptr = realloc ( self . ptr . as_ptr ( ) as * mut u8 , old_layout , new_layout . size ( ) ) ; let ptr = utils :: set_ptr_value_mut ( self . ptr . as_ptr ( ) , bytes_ptr ) ; self . ptr = NonNull :: new ( ptr ) . unwrap ( ) ; self . cap = count ; }
Reallocate so that the vector has the exact requested capacity
unsafe because the new capacity may be less than self.len
Reallocate so that the vector has the exact requested capacity unsafe because the new capacity may be less than self . len
&mut self
count
usize