[][src]Trait gaps::RangeGappable

pub trait RangeGappable<'s, T> {
    type Iter;
    pub fn gaps<R>(&'s self, range: R) -> GapIter<Copied<Self::Iter>, T>
    where
        R: RangeBounds<T>
; }

An extension trait that provides range based access to the "gaps" in collections with a range method.

BTreeSet and BTreeMap are the two most prominent examples of such collections.

use std::ops::Bound;

let set = btreeset!{1, 3, 4};
let mut gaps = set.gaps(0..=6);
assert_eq!(gaps.next(), Some((Bound::Included(0), Bound::Excluded(1))));
assert_eq!(gaps.next(), Some((Bound::Excluded(1), Bound::Excluded(3))));
assert_eq!(gaps.next(), Some((Bound::Excluded(4), Bound::Included(6))));
assert_eq!(gaps.next(), None);

Associated Types

Loading content...

Required methods

pub fn gaps<R>(&'s self, range: R) -> GapIter<Copied<Self::Iter>, T> where
    R: RangeBounds<T>, 
[src]

Loading content...

Implementations on Foreign Types

impl<'s, V> RangeGappable<'s, V> for BTreeSet<V> where
    V: Copy + Ord + Inc + 's, 
[src]

type Iter = BTreeSetRange<'s, V>

impl<'s, K, V> RangeGappable<'s, K> for BTreeMap<K, V> where
    K: Copy + Ord + Inc + 's,
    V: 's, 
[src]

type Iter = Map<BTreeMapRange<'s, K, V>, fn(_: (&'s K, &'s V)) -> &'s K>

Loading content...

Implementors

Loading content...