From: Dietmar Maurer Date: Tue, 7 Jan 2025 12:52:16 +0000 (+0100) Subject: input_panel: cleanup: avoid generic parameter to reduce code size X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f5887464ac1710087e189b3ed31d1a49c5f33fe6;p=ui%2Fproxmox-yew-widget-toolkit.git input_panel: cleanup: avoid generic parameter to reduce code size Signed-off-by: Dietmar Maurer --- diff --git a/src/widget/input_panel.rs b/src/widget/input_panel.rs index 16f5d4b..06d8c6b 100644 --- a/src/widget/input_panel.rs +++ b/src/widget/input_panel.rs @@ -87,7 +87,8 @@ impl InputPanel { Container::from_tag("hr") .key(key) .class("pwt-w-100") - .margin_y(2), + .margin_y(2) + .into(), ); } @@ -99,7 +100,7 @@ impl InputPanel { /// Adds custom child in the first column pub fn add_custom_child(&mut self, child: impl Into) { - self.add_custom_child_impl(FieldPosition::Left, false, child); + self.add_custom_child_impl(FieldPosition::Left, false, child.into()); } /// Builder style method to add a custom child in the second column @@ -110,7 +111,7 @@ impl InputPanel { /// Adds custom child in the second column pub fn add_right_custom_child(&mut self, child: impl Into) { - self.add_custom_child_impl(FieldPosition::Right, false, child); + self.add_custom_child_impl(FieldPosition::Right, false, child.into()); } /// Builder style method to add a large custom child @@ -121,15 +122,10 @@ impl InputPanel { /// Adds large custom child pub fn add_large_custom_child(&mut self, child: impl Into) { - self.add_custom_child_impl(FieldPosition::Large, false, child); + self.add_custom_child_impl(FieldPosition::Large, false, child.into()); } - fn add_custom_child_impl( - &mut self, - column: FieldPosition, - advanced: bool, - child: impl Into, - ) { + fn add_custom_child_impl(&mut self, column: FieldPosition, advanced: bool, child: Html) { let (row, start, span) = match column { FieldPosition::Left => { self.left_count += 1; @@ -161,7 +157,6 @@ impl InputPanel { }; let class = classes!("pwt-align-self-center"); - let child = child.into(); let key = match child.key() { Some(key) => key.clone(), None => {