IndexBuffer: add clear()

This commit is contained in:
Michael Sippel 2023-02-28 12:57:15 +01:00
parent 8153da2091
commit c41f6937ca
Signed by: senvas
GPG key ID: F96CF119C34B64A6
2 changed files with 6 additions and 1 deletions

View file

@ -110,6 +110,11 @@ where
self.data.write().unwrap().remove(&key);
self.port.notify(&IndexArea::Set(vec![key]));
}
pub fn clear(&mut self) {
self.data.write().unwrap().clear();
self.port.notify(&IndexArea::Set(self.data.read().unwrap().keys().cloned().collect()));
}
}
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>

View file

@ -9,7 +9,7 @@ use {
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>
#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum IndexArea<Key> {
Empty,
Full,