fn init_iter_mut<T, R>(
        map: &'a mut SgMap<K, V, N>,
        range: &R,
    ) -> (
        RangeMutPeekable<'a, K, V, N>,
        Option<RangeMutLast<'a, K, V, N>>,
    )
    where
        T: Ord + ?Sized,
        K: Borrow<T> + Ord + Default,
        R: RangeBounds<T>,
    {
        let mut peekable = map.bst.iter_mut().peekable();
        let mut last = None;

        // Advance mutable iter to start
        while let Some(node) = peekable.peek() {
            if range.contains(node.0.borrow()) {
                break;
            }

            peekable.next();
        }

        while let Some(node) = peekable.next_back() {
            if range.contains(node.0.borrow()) {
                last = Some(node);
                break;
            }
        }

        (peekable, last)
    }
// Prepare mutable iterator to return first item in range
Prepare mutable iterator to return first item in range
Prepare mutable iterator to return first item in range
fn init_iter_mut<T, R>(
        map: &'a mut SgMap<K, V, N>,
        range: &R,
    ) -> (
        RangeMutPeekable<'a, K, V, N>,
        Option<RangeMutLast<'a, K, V, N>>,
    )
    where
        T: Ord + ?Sized,
        K: Borrow<T> + Ord + Default,
        R: RangeBounds<T>,
    {
        let mut peekable = map.bst.iter_mut().peekable();
        let mut last = None;
        // Advance mutable iter to start
        while let Some(node) = peekable.peek() {
            if range.contains(node.0.borrow()) {
                break;
            }
            peekable.next();
        }
        while let Some(node) = peekable.next_back() {
            if range.contains(node.0.borrow()) {
                last = Some(node);
                break;
            }
        }
        (peekable, last)
    }
fn init_iter_mut < T , R > ( map : & ' a mut SgMap < K , V , N > , range : & R , ) -> ( RangeMutPeekable < ' a , K , V , N > , Option < RangeMutLast < ' a , K , V , N > > , ) where T : Ord + ? Sized , K : Borrow < T > + Ord + Default , R : RangeBounds < T > , { let mut peekable = map . bst . iter_mut ( ) . peekable ( ) ; let mut last = None ; // Advance mutable iter to start while let Some ( node ) = peekable . peek ( ) { if range . contains ( node . 0 . borrow ( ) ) { break ; } peekable . next ( ) ; } while let Some ( node ) = peekable . next_back ( ) { if range . contains ( node . 0 . borrow ( ) ) { last = Some ( node ) ; break ; } } ( peekable , last ) }
Prepare mutable iterator to return first item in range
Prepare mutable iterator to return first item in range
map
&'a mut SgMap<K, V, N>
range
&R
map
&'a mut SgMap<K, V, N>
range
&R