pub fn remove(&mut self, index: usize) -> T {
        let len = self.len();
        assert!(index < len);
        unsafe {
            // infallible
            let ret;
            {
                // the place we are taking from.
                let ptr = self.buf.as_mut_ptr().add(index);
                // copy it out, unsafely having a copy of the value on
                // the stack and in the vector at the same time.
                ret = ptr::read(ptr);

                // Shift everything down to fill in that spot.
                ptr::copy(ptr.offset(1), ptr, len - index - 1);
            }
            self.set_len(len - 1);
            ret
        }
    }
/// Removes and returns the element at position `index` within the vector,
/// shifting all elements after it to the left.
///
/// # Panics
///
/// Panics if `index` is out of bounds.
///
/// # Examples
///
/// ```
/// # use corundum::vec::Vec;
/// # use corundum::alloc::heap::*;
/// Heap::transaction(|j| {
///     let mut v = Vec::from_slice(&[1, 2, 3], j);
///     assert_eq!(v.remove(1), 2);
///     assert_eq!(v, [1, 3]);
/// }).unwrap();
/// ```
Removes and returns the element at position `index` within the vector,
shifting all elements after it to the left.
Removes and returns the element at position ` index ` within the vector shifting all elements after it to the left .
pub fn remove(&mut self, index: usize) -> T {
        let len = self.len();
        assert!(index < len);
        unsafe {
            // infallible
            let ret;
            {
                // the place we are taking from.
                let ptr = self.buf.as_mut_ptr().add(index);
                // copy it out, unsafely having a copy of the value on
                // the stack and in the vector at the same time.
                ret = ptr::read(ptr);
                // Shift everything down to fill in that spot.
                ptr::copy(ptr.offset(1), ptr, len - index - 1);
            }
            self.set_len(len - 1);
            ret
        }
    }
pub fn remove ( & mut self , index : usize ) -> T { let len = self . len ( ) ; assert ! ( index len ) ; unsafe { // infallible let ret ; { // the place we are taking from. let ptr = self . buf . as_mut_ptr ( ) . add ( index ) ; // copy it out, unsafely having a copy of the value on // the stack and in the vector at the same time. ret = ptr :: read ( ptr ) ; // Shift everything down to fill in that spot. ptr :: copy ( ptr . offset ( 1 ) , ptr , len - index - 1 ) ; } self . set_len ( len - 1 ) ; ret } }
Removes and returns the element at position `index` within the vector,
shifting all elements after it to the left.
Removes and returns the element at position ` index ` within the vector shifting all elements after it to the left .
&mut self
index
usize
panics
Panics if `index` is out of bounds.
Panics if ` index ` is out of bounds .
examples
None
use corundum::vec::vec;
None
use corundum::alloc::heap::*;
None