diff --git a/packages/html/src/events/form.rs b/packages/html/src/events/form.rs index 249d17c79..75cc51978 100644 --- a/packages/html/src/events/form.rs +++ b/packages/html/src/events/form.rs @@ -1,5 +1,6 @@ use crate::file_data::FileEngine; use crate::file_data::HasFileData; +use std::ops::Deref; use std::{collections::HashMap, fmt::Debug}; use dioxus_core::Event; @@ -18,6 +19,7 @@ pub enum FormValue { Text(String), VecText(Vec), } + impl From for Vec { fn from(value: FormValue) -> Self { match value { @@ -26,6 +28,15 @@ impl From for Vec { } } } + +impl Deref for FormValue { + type Target = [String]; + + fn deref(&self) -> &Self::Target { + self.as_slice() + } +} + impl FormValue { /// Convenient way to represent Value as slice pub fn as_slice(&self) -> &[String] {