fn split(&mut self) -> (K, V, Node<K, V>) {
        // Necessary for correctness, but in a private function
        debug_assert!(!self.is_empty());

        let mut right = if self.is_leaf() {
            Node::new_leaf(self.capacity())
        } else {
            unsafe { Node::new_internal(self.capacity()) }
        };

        unsafe {
            right._len = self.len() / 2;
            let right_offset = self.len() - right.len();
            ptr::copy_nonoverlapping(
                self.keys().as_ptr().offset(right_offset as isize),
                right.keys_mut().as_mut_ptr(),
                right.len()
            );
            ptr::copy_nonoverlapping(
                self.vals().as_ptr().offset(right_offset as isize),
                right.vals_mut().as_mut_ptr(),
                right.len()
            );
            if !self.is_leaf() {
                ptr::copy_nonoverlapping(
                    self.edges().as_ptr().offset(right_offset as isize),
                    right.edges_mut().as_mut_ptr(),
                    right.len() + 1
                );
            }

            let key = ptr::read(self.keys().get_unchecked(right_offset - 1));
            let val = ptr::read(self.vals().get_unchecked(right_offset - 1));

            self._len = right_offset - 1;

            (key, val, right)
        }
    }
/// Node is full, so split it into two nodes, and yield the middle-most key-value pair
/// because we have one too many, and our parent now has one too few
Node is full, so split it into two nodes, and yield the middle-most key-value pair
because we have one too many, and our parent now has one too few
Node is full so split it into two nodes and yield the middle - most key - value pair because we have one too many and our parent now has one too few
fn split(&mut self) -> (K, V, Node<K, V>) {
        // Necessary for correctness, but in a private function
        debug_assert!(!self.is_empty());
        let mut right = if self.is_leaf() {
            Node::new_leaf(self.capacity())
        } else {
            unsafe { Node::new_internal(self.capacity()) }
        };
        unsafe {
            right._len = self.len() / 2;
            let right_offset = self.len() - right.len();
            ptr::copy_nonoverlapping(
                self.keys().as_ptr().offset(right_offset as isize),
                right.keys_mut().as_mut_ptr(),
                right.len()
            );
            ptr::copy_nonoverlapping(
                self.vals().as_ptr().offset(right_offset as isize),
                right.vals_mut().as_mut_ptr(),
                right.len()
            );
            if !self.is_leaf() {
                ptr::copy_nonoverlapping(
                    self.edges().as_ptr().offset(right_offset as isize),
                    right.edges_mut().as_mut_ptr(),
                    right.len() + 1
                );
            }
            let key = ptr::read(self.keys().get_unchecked(right_offset - 1));
            let val = ptr::read(self.vals().get_unchecked(right_offset - 1));
            self._len = right_offset - 1;
            (key, val, right)
        }
    }
fn split ( & mut self ) -> ( K , V , Node < K , V > ) { // Necessary for correctness, but in a private function debug_assert ! ( self is_empty ( ) ) ; let mut right = if self . is_leaf ( ) { Node :: new_leaf ( self . capacity ( ) ) } else { unsafe { Node :: new_internal ( self . capacity ( ) ) } } ; unsafe { right . _len = self . len ( ) / 2 ; let right_offset = self . len ( ) - right . len ( ) ; ptr :: copy_nonoverlapping ( self . keys ( ) . as_ptr ( ) . offset ( right_offset as isize ) , right . keys_mut ( ) . as_mut_ptr ( ) , right . len ( ) ) ; ptr :: copy_nonoverlapping ( self . vals ( ) . as_ptr ( ) . offset ( right_offset as isize ) , right . vals_mut ( ) . as_mut_ptr ( ) , right . len ( ) ) ; if ! self . is_leaf ( ) { ptr :: copy_nonoverlapping ( self . edges ( ) . as_ptr ( ) . offset ( right_offset as isize ) , right . edges_mut ( ) . as_mut_ptr ( ) , right . len ( ) + 1 ) ; } let key = ptr :: read ( self . keys ( ) . get_unchecked ( right_offset - 1 ) ) ; let val = ptr :: read ( self . vals ( ) . get_unchecked ( right_offset - 1 ) ) ; self . _len = right_offset - 1 ; ( key , val , right ) } }
Node is full, so split it into two nodes, and yield the middle-most key-value pair
because we have one too many, and our parent now has one too few
Node is full so split it into two nodes and yield the middle - most key - value pair because we have one too many and our parent now has one too few
&mut self