fn insert_new(
        &mut self,
        value: EntryData,
        previous: Option<usize>,
        next: Option<usize>,
    ) -> usize {
        use self::Entry::*;

        self.length += 1;

        if self.length == usize::max_value() {
            panic!("reached maximum possible length");
        }

        match self.vacant_head() {
            Some(index) => {
                self.set_vacant_head(self.entries[index].vacant_ref().next);
                self.entries[index] =
                    Occupied(OccupiedEntry::new(self.generation, previous, next, value));
                index
            }
            None => {
                self.entries.push(Occupied(OccupiedEntry::new(
                    self.generation,
                    previous,
                    next,
                    value,
                )));
                self.entries.len() - 1
            }
        }
    }
/// Inserts the given value into the list with its expected previous and next value indices.
///
/// # Panics
///
/// Panics if the new capacity overflows `usize`.
Inserts the given value into the list with its expected previous and next value indices.
Inserts the given value into the list with its expected previous and next value indices .
fn insert_new(
        &mut self,
        value: EntryData,
        previous: Option<usize>,
        next: Option<usize>,
    ) -> usize {
        use self::Entry::*;
        self.length += 1;
        if self.length == usize::max_value() {
            panic!("reached maximum possible length");
        }
        match self.vacant_head() {
            Some(index) => {
                self.set_vacant_head(self.entries[index].vacant_ref().next);
                self.entries[index] =
                    Occupied(OccupiedEntry::new(self.generation, previous, next, value));
                index
            }
            None => {
                self.entries.push(Occupied(OccupiedEntry::new(
                    self.generation,
                    previous,
                    next,
                    value,
                )));
                self.entries.len() - 1
            }
        }
    }
fn insert_new ( & mut self , value : EntryData , previous : Option < usize > , next : Option < usize > , ) -> usize { use self :: Entry :: * ; self . length += 1 ; if self . length == usize :: max_value ( ) { panic ! ( " " ) ; } match self . vacant_head ( ) { Some ( index ) => { self . set_vacant_head ( self . entries [ index ] . vacant_ref ( ) . next ) ; self . entries [ index ] = Occupied ( OccupiedEntry :: new ( self . generation , previous , next , value ) ) ; index } None => { self . entries . push ( Occupied ( OccupiedEntry :: new ( self . generation , previous , next , value , ) ) ) ; self . entries . len ( ) - 1 } } }
Inserts the given value into the list with its expected previous and next value indices.
Inserts the given value into the list with its expected previous and next value indices .
&mut self
value
EntryData
previous
Option<usize>
next
Option<usize>
&mut self
value
EntryData
previous
Option<usize>
next
Option<usize>
panics
Panics if the new capacity overflows `usize`.
Panics if the new capacity overflows ` usize ` .