1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::bits::bitfield::Bitfield;
use crate::traits::idxset::IdxSet;

/// An `IdxSet` containing nothing.
#[derive(Clone)]
pub struct NoIdx;

impl Iterator for NoIdx {
    type Item = Bitfield;

    fn next(&mut self) -> Option<Self::Item> {
        None
    }
}

impl DoubleEndedIterator for NoIdx {
    fn next_back(&mut self) -> Option<Self::Item> {
        None
    }
}

impl IdxSet for NoIdx {
    type IdxIter = <Self as IntoIterator>::IntoIter;

    fn into_idx_iter(self) -> Self::IdxIter {
        self
    }

    fn size(&self) -> usize {
        0
    }

    fn intersect(&self, idx: &Bitfield) -> Bitfield {
        Bitfield::new_empty(idx.start())
    }
}