Add a Table::zero method to clear all entries

This commit is contained in:
Philipp Oppermann
2017-04-13 18:33:26 +02:00
parent 2b7fa410fb
commit e50d70c02e

View File

@@ -6,6 +6,14 @@ pub struct Table {
entries: [Entry; ENTRY_COUNT], entries: [Entry; ENTRY_COUNT],
} }
impl Table {
pub fn zero(&mut self) {
for entry in self.entries.iter_mut() {
entry.set_unused();
}
}
}
impl Index<usize> for Table { impl Index<usize> for Table {
type Output = Entry; type Output = Entry;