1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
use super::Table;

/// Represents an iterator through all the entries in the table.
/// 
/// This iterator will first walk through entries of the static table and then
/// through entries of the dynamic table.
#[derive(Clone, Copy)]
pub struct TableIter<'a> {
    pub index: u32,
    pub table: &'a Table<'a>,
}

impl<'a> Iterator for TableIter<'a> {
    type Item = (&'a [u8], &'a [u8]);
    
    fn next(&mut self) -> Option<(&'a [u8], &'a [u8])> {
        let res = self.table.get(self.index);
        self.index += 1;
        res
    }
}