fn extend_desugared<I: Iterator<Item = T>>(&mut self, mut iterator: I) {
        // This is the case for a general iterator.
        //
        // This function should be the moral equivalent of:
        //
        //      for item in iterator {
        //          self.push(item);
        //      }
        while let Some(element) = iterator.next() {
            let len = self.len();
            if len == self.capacity() {
                let (lower, _) = iterator.size_hint();
                self.reserve(lower.saturating_add(1));
            }
            unsafe {
                ptr::write(self.as_mut_ptr().add(len), element);
                // NB can't overflow since we would have had to alloc the address space
                self.set_len(len + 1);
            }
        }
    }
// leaf method to which various SpecFrom/SpecExtend implementations delegate when
// they have no further optimizations to apply
leaf method to which various SpecFrom/SpecExtend implementations delegate when
they have no further optimizations to apply
leaf method to which various SpecFrom / SpecExtend implementations delegate when they have no further optimizations to apply
fn extend_desugared<I: Iterator<Item = T>>(&mut self, mut iterator: I) {
        // This is the case for a general iterator.
        //
        // This function should be the moral equivalent of:
        //
        //      for item in iterator {
        //          self.push(item);
        //      }
        while let Some(element) = iterator.next() {
            let len = self.len();
            if len == self.capacity() {
                let (lower, _) = iterator.size_hint();
                self.reserve(lower.saturating_add(1));
            }
            unsafe {
                ptr::write(self.as_mut_ptr().add(len), element);
                // NB can't overflow since we would have had to alloc the address space
                self.set_len(len + 1);
            }
        }
    }
fn extend_desugared < I : Iterator < Item = T > > ( & mut self , mut iterator : I ) { // This is the case for a general iterator. // // This function should be the moral equivalent of: // //      for item in iterator { //          self.push(item); //      } while let Some ( element ) = iterator . next ( ) { let len = self . len ( ) ; if len == self . capacity ( ) { let ( lower , _ ) = iterator . size_hint ( ) ; self . reserve ( lower . saturating_add ( 1 ) ) ; } unsafe { ptr :: write ( self . as_mut_ptr ( ) . add ( len ) , element ) ; // NB can't overflow since we would have had to alloc the address space self . set_len ( len + 1 ) ; } } }
leaf method to which various SpecFrom/SpecExtend implementations delegate when
they have no further optimizations to apply
leaf method to which various SpecFrom / SpecExtend implementations delegate when they have no further optimizations to apply
&mut self
iterator
I
&mut self
iterator
I