fn compute_len<T, R>(map: &SgMap<K, V, N>, range: &R) -> usize
    where
        T: Ord + ?Sized,
        K: Borrow<T> + Ord + Default,
        R: RangeBounds<T>,
    {
        let mut peekable = map.bst.iter().peekable();
        let mut len = 0;

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

            peekable.next();
        }

        // Count remaining
        for node in peekable {
            if range.contains(node.0.borrow()) {
                len += 1;
            } else {
                break;
            }
        }

        len
    }
// Compute amount of items to return
Compute amount of items to return
Compute amount of items to return
fn compute_len<T, R>(map: &SgMap<K, V, N>, range: &R) -> usize
    where
        T: Ord + ?Sized,
        K: Borrow<T> + Ord + Default,
        R: RangeBounds<T>,
    {
        let mut peekable = map.bst.iter().peekable();
        let mut len = 0;
        // Advance immutable iter to start
        while let Some(node) = peekable.peek() {
            if range.contains(node.0.borrow()) {
                break;
            }
            peekable.next();
        }
        // Count remaining
        for node in peekable {
            if range.contains(node.0.borrow()) {
                len += 1;
            } else {
                break;
            }
        }
        len
    }
fn compute_len < T , R > ( map : & SgMap < K , V , N > , range : & R ) -> usize where T : Ord + ? Sized , K : Borrow < T > + Ord + Default , R : RangeBounds < T > , { let mut peekable = map . bst . iter ( ) . peekable ( ) ; let mut len = 0 ; // Advance immutable iter to start while let Some ( node ) = peekable . peek ( ) { if range . contains ( node . 0 . borrow ( ) ) { break ; } peekable . next ( ) ; } // Count remaining for node in peekable { if range . contains ( node . 0 . borrow ( ) ) { len += 1 ; } else { break ; } } len }
Compute amount of items to return
Compute amount of items to return
map
&SgMap<K, V, N>
range
&R
map
&SgMap<K, V, N>
range
&R