pub fn reserve_exact(&mut self, capacity: uint) {
        if mem::size_of::<T>() == 0 { return }

        if capacity > self.cap {
            let size = capacity.checked_mul(&mem::size_of::<T>())
                               .expect("capacity overflow");
            unsafe {
                self.ptr = alloc_or_realloc(self.ptr, self.cap * mem::size_of::<T>(), size);
            }
            self.cap = capacity;
        }
    }
/// Reserves capacity for exactly `capacity` elements in the given vector.
///
/// If the capacity for `self` is already equal to or greater than the
/// requested capacity, then no action is taken.
///
/// # Example
///
/// ```
/// let mut vec: Vec<int> = Vec::with_capacity(10);
/// vec.reserve_exact(11);
/// assert_eq!(vec.capacity(), 11);
/// ```
Reserves capacity for exactly `capacity` elements in the given vector.
If the capacity for `self` is already equal to or greater than the
requested capacity, then no action is taken.
Reserves capacity for exactly ` capacity ` elements in the given vector . If the capacity for ` self ` is already equal to or greater than the requested capacity then no action is taken .
pub fn reserve_exact(&mut self, capacity: uint) {
        if mem::size_of::<T>() == 0 { return }
        if capacity > self.cap {
            let size = capacity.checked_mul(&mem::size_of::<T>())
                               .expect("capacity overflow");
            unsafe {
                self.ptr = alloc_or_realloc(self.ptr, self.cap * mem::size_of::<T>(), size);
            }
            self.cap = capacity;
        }
    }
pub fn reserve_exact ( & mut self , capacity : uint ) { if mem :: size_of :: < T > ( ) == 0 { return } if capacity > self . cap { let size = capacity . checked_mul ( & mem :: size_of :: < T > ( ) ) . expect ( " " ) ; unsafe { self . ptr = alloc_or_realloc ( self . ptr , self . cap * mem :: size_of :: < T > ( ) , size ) ; } self . cap = capacity ; } }
Reserves capacity for exactly `capacity` elements in the given vector.
Reserves capacity for exactly ` capacity ` elements in the given vector .
&mut self
capacity
uint
&mut self
capacity
uint
example
None