httlib_hpack/table/iter.rs
1use super::Table;
2
3/// Represents an iterator through all the entries in the table.
4///
5/// This iterator will first walk through entries of the static table and then
6/// through entries of the dynamic table.
7#[derive(Clone, Copy)]
8pub struct TableIter<'a> {
9 pub index: u32,
10 pub table: &'a Table<'a>,
11}
12
13impl<'a> Iterator for TableIter<'a> {
14 type Item = (&'a [u8], &'a [u8]);
15
16 fn next(&mut self) -> Option<(&'a [u8], &'a [u8])> {
17 let res = self.table.get(self.index);
18 self.index += 1;
19 res
20 }
21}