From 13efd32e2329fa4e763c31be2e02cf97098b126b Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Wed, 5 Jul 2023 23:48:30 +0200 Subject: [PATCH] iced_element: Use HashMap to track Outputs --- src/utils/iced.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/iced.rs b/src/utils/iced.rs index 65f2909b..53ceb470 100644 --- a/src/utils/iced.rs +++ b/src/utils/iced.rs @@ -1,5 +1,5 @@ use std::{ - collections::HashMap, + collections::{HashMap, HashSet}, fmt, hash::{Hash, Hasher}, sync::{mpsc::Receiver, Arc, Mutex}, @@ -124,7 +124,7 @@ impl IcedProgram for ProgramWrapper

{ struct IcedElementInternal { // draw buffer - outputs: Vec, + outputs: HashSet, buffers: HashMap, (MemoryRenderBuffer, Option<(Vec, Color)>)>, // state @@ -238,7 +238,7 @@ impl IcedElement

{ .ok(); let mut internal = IcedElementInternal { - outputs: Vec::new(), + outputs: HashSet::new(), buffers: HashMap::new(), size, cursor_pos: None, @@ -569,11 +569,11 @@ impl SpaceElement for IcedElement

{ ), ); } - internal.outputs.push(output.clone()); + internal.outputs.insert(output.clone()); } fn output_leave(&self, output: &Output) { - self.0.lock().unwrap().outputs.retain(|o| o != output); + self.0.lock().unwrap().outputs.remove(output); self.refresh(); }