From c41f6937cafe06e62990ac73ec37140a3af1a0c8 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 28 Feb 2023 12:57:15 +0100 Subject: [PATCH] IndexBuffer: add clear() --- src/buffer/index_hashmap.rs | 5 +++++ src/view/index/mod.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/buffer/index_hashmap.rs b/src/buffer/index_hashmap.rs index 0593865..72b0625 100644 --- a/src/buffer/index_hashmap.rs +++ b/src/buffer/index_hashmap.rs @@ -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())); + } } //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> diff --git a/src/view/index/mod.rs b/src/view/index/mod.rs index 95f0acc..2821e86 100644 --- a/src/view/index/mod.rs +++ b/src/view/index/mod.rs @@ -9,7 +9,7 @@ use { //<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>> -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum IndexArea { Empty, Full,