From 1e2709dc8c2c2c4a7d54285a1d843f26a8be89d8 Mon Sep 17 00:00:00 2001 From: Mitchell M Date: Wed, 12 Jun 2024 16:29:35 -0500 Subject: [PATCH] ControlRenderData no long has boxed data --- src/controls/button.rs | 2 +- src/controls/group.rs | 2 +- src/controls/heading.rs | 1 - src/controls/mod.rs | 7 +++---- src/form_builder.rs | 4 ++-- src/styles/grid_form.rs | 4 ++-- src/styles/mod.rs | 1 - 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/controls/button.rs b/src/controls/button.rs index d47e803..841d64b 100644 --- a/src/controls/button.rs +++ b/src/controls/button.rs @@ -27,7 +27,7 @@ impl FormBuilder { let control = builder(button_builder); let render_data = ControlRenderData { - data: Box::new(control.data), + data: control.data, styles: control.styles, }; diff --git a/src/controls/group.rs b/src/controls/group.rs index a2ad21e..9ddf664 100644 --- a/src/controls/group.rs +++ b/src/controls/group.rs @@ -19,7 +19,7 @@ impl FormBuilder { .unzip(); let view = fs.group(super::ControlRenderData { - data: Box::new(views.collect_view()), + data: views.collect_view(), styles: group_builder.styles, }); let validation_cb = move || { diff --git a/src/controls/heading.rs b/src/controls/heading.rs index c9d05a9..1f95191 100644 --- a/src/controls/heading.rs +++ b/src/controls/heading.rs @@ -16,7 +16,6 @@ impl VanityControlData for HeadingData { fs.heading(control) } } -// TODO: impl GetterVanityControl impl FormBuilder { pub fn heading( diff --git a/src/controls/mod.rs b/src/controls/mod.rs index b672936..5d8c113 100644 --- a/src/controls/mod.rs +++ b/src/controls/mod.rs @@ -70,9 +70,8 @@ pub trait ValidatedControlData: ControlData {} /// The data needed to render a interactive control of type `C`. pub struct ControlRenderData { - // TODO: Does this need to be boxed? This isn't trait objected any more - pub data: Box, pub styles: Vec, + pub data: C, } /// The data needed to render a read-only control of type `C`. @@ -101,7 +100,7 @@ impl VanityControlBuilder pub(crate) fn build(self) -> BuiltVanityControlData { BuiltVanityControlData { render_data: ControlRenderData { - data: Box::new(self.data), + data: self.data, styles: self.style_attributes, }, getter: self.getter, @@ -209,7 +208,7 @@ impl ControlBuilder FormBuilder { .unzip(); let elements = fs.form_frame(ControlRenderData { - data: Box::new(views.into_view()), + data: views.into_view(), styles: self.styles, }); @@ -271,7 +271,7 @@ impl FormBuilder { .unzip(); let elements = fs.form_frame(ControlRenderData { - data: Box::new(views.into_view()), + data: views.into_view(), styles: self.styles, }); diff --git a/src/styles/grid_form.rs b/src/styles/grid_form.rs index ab4ebae..3a76b16 100644 --- a/src/styles/grid_form.rs +++ b/src/styles/grid_form.rs @@ -22,7 +22,7 @@ impl FormStyle for GridFormStyle { type StylingAttributes = GridFormStylingAttributes; fn form_frame(&self, form: ControlRenderData) -> View { - view! {
{*form.data}
}.into_view() + view! {
{form.data}
}.into_view() } fn heading(&self, control: ControlRenderData) -> View { @@ -392,7 +392,7 @@ impl FormStyle for GridFormStyle { view! {
- {*group.data} + {group.data}
} .into_view() diff --git a/src/styles/mod.rs b/src/styles/mod.rs index 6e3bd47..323d56f 100644 --- a/src/styles/mod.rs +++ b/src/styles/mod.rs @@ -89,7 +89,6 @@ pub trait FormStyle: 'static { validation_state: Signal>, ) -> View; fn submit(&self, control: ControlRenderData) -> View; - // TODO: test custom component fn custom_component(&self, view: View) -> View; fn group(&self, group: ControlRenderData) -> View; fn spacer(&self, control: ControlRenderData) -> View;