From 3a0f3140b8bb26c0a6937f45a546d38c77a6f33f Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 14 Nov 2023 22:47:00 +0100 Subject: [PATCH] Update Vizia param base for upstream changes --- nih_plug_vizia/src/widgets/param_base.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/nih_plug_vizia/src/widgets/param_base.rs b/nih_plug_vizia/src/widgets/param_base.rs index 7eef61d0..caab3465 100644 --- a/nih_plug_vizia/src/widgets/param_base.rs +++ b/nih_plug_vizia/src/widgets/param_base.rs @@ -42,14 +42,19 @@ where FMap: Fn(&Params) -> &P + Copy + 'static, { fn clone(&self) -> Self { - Self { - param: self.param, - params: self.params.clone(), - params_to_param: self.params_to_param, - } + *self } } +impl Copy for ParamWidgetData +where + L: Lens + Copy, + Params: 'static, + P: Param + 'static, + FMap: Fn(&Params) -> &P + Copy + 'static, +{ +} + impl ParamWidgetData where L: Lens + Clone, @@ -72,7 +77,7 @@ where { let params_to_param = self.params_to_param; - self.params.clone().map(move |params| { + self.params.map(move |params| { let param = params_to_param(params); f(param) }) @@ -136,7 +141,6 @@ impl ParamWidgetBase { // outlive the editor let param: &P = unsafe { &*params - .clone() .map(move |params| params_to_param(params) as *const P) .get(cx) };