fn range<'b>(
        &'b self,
        start: Option<&[u8]>,
        end: Option<&[u8]>,
        order: Order,
    ) -> Box<dyn Iterator<Item = KV> + 'b> {
        let bounds = range_bounds(start, end);

        // BTreeMap.range panics if range is start > end.
        // However, this cases represent just empty range and we treat it as such.
        let local: Box<dyn Iterator<Item = BTreeMapPairRef<Delta>>> =
            match (bounds.start_bound(), bounds.end_bound()) {
                (Bound::Included(start), Bound::Excluded(end)) if start > end => {
                    Box::new(iter::empty())
                }
                _ => {
                    let local_raw = self.local_state.range(bounds);
                    match order {
                        Order::Ascending => Box::new(local_raw),
                        Order::Descending => Box::new(local_raw.rev()),
                    }
                }
            };

        let base = self.storage.range(start, end, order);
        let merged = MergeOverlay::new(local, base, order);
        Box::new(merged)
    }
/// range allows iteration over a set of keys, either forwards or backwards
/// uses standard rust range notation, and eg db.range(b"foo"..b"bar") also works reverse
range allows iteration over a set of keys, either forwards or backwards
uses standard rust range notation, and eg db.range(b"foo"..b"bar") also works reverse
range allows iteration over a set of keys either forwards or backwards uses standard rust range notation and eg db . range ( b " foo " .. b " bar " ) also works reverse
fn range<'b>(
        &'b self,
        start: Option<&[u8]>,
        end: Option<&[u8]>,
        order: Order,
    ) -> Box<dyn Iterator<Item = KV> + 'b> {
        let bounds = range_bounds(start, end);
        // BTreeMap.range panics if range is start > end.
        // However, this cases represent just empty range and we treat it as such.
        let local: Box<dyn Iterator<Item = BTreeMapPairRef<Delta>>> =
            match (bounds.start_bound(), bounds.end_bound()) {
                (Bound::Included(start), Bound::Excluded(end)) if start > end => {
                    Box::new(iter::empty())
                }
                _ => {
                    let local_raw = self.local_state.range(bounds);
                    match order {
                        Order::Ascending => Box::new(local_raw),
                        Order::Descending => Box::new(local_raw.rev()),
                    }
                }
            };
        let base = self.storage.range(start, end, order);
        let merged = MergeOverlay::new(local, base, order);
        Box::new(merged)
    }
fn range < ' b > ( & ' b self , start : Option < & [ u8 ] > , end : Option < & [ u8 ] > , order : Order , ) -> Box < dyn Iterator < Item = KV > + ' b > { let bounds = range_bounds ( start , end ) ; // BTreeMap.range panics if range is start > end. // However, this cases represent just empty range and we treat it as such. let local : Box < dyn Iterator < Item = BTreeMapPairRef < Delta > > > = match ( bounds . start_bound ( ) , bounds . end_bound ( ) ) { ( Bound :: Included ( start ) , Bound :: Excluded ( end ) ) if start > end => { Box :: new ( iter :: empty ( ) ) } _ => { let local_raw = self . local_state . range ( bounds ) ; match order { Order :: Ascending => Box :: new ( local_raw ) , Order :: Descending => Box :: new ( local_raw . rev ( ) ) , } } } ; let base = self . storage . range ( start , end , order ) ; let merged = MergeOverlay :: new ( local , base , order ) ; Box :: new ( merged ) }
range allows iteration over a set of keys, either forwards or backwards
uses standard rust range notation, and eg db.range(b"foo"..b"bar") also works reverse
range allows iteration over a set of keys either forwards or backwards uses standard rust range notation and eg db . range ( b " foo " .. b " bar " ) also works reverse
&'b self
start
Option<&[u8]>
end
Option<&[u8]>
order
Order
&'b self
start
Option<&[u8]>
end
Option<&[u8]>
order
Order