mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 14:44:12 +00:00
rustfmt
This commit is contained in:
parent
c1fbf31a27
commit
a92d1a9424
2 changed files with 7 additions and 10 deletions
|
@ -20,7 +20,7 @@ pub enum FormValue {
|
|||
}
|
||||
impl Into<Vec<String>> for FormValue {
|
||||
fn into(self) -> Vec<String> {
|
||||
match self{
|
||||
match self {
|
||||
FormValue::Text(s) => vec![s],
|
||||
FormValue::VecText(vec) => vec,
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ impl Into<Vec<String>> for FormValue {
|
|||
impl FormValue {
|
||||
/// Convenient way to represent Value as slice
|
||||
pub fn as_slice(&self) -> &[String] {
|
||||
match self{
|
||||
match self {
|
||||
FormValue::Text(s) => std::slice::from_ref(s),
|
||||
FormValue::VecText(vec) => vec.as_slice(),
|
||||
}
|
||||
|
|
|
@ -395,12 +395,10 @@ impl HasFormData for WebFormData {
|
|||
match map.entry(key) {
|
||||
std::collections::hash_map::Entry::Occupied(mut o) => {
|
||||
let first_value = match o.get_mut() {
|
||||
FormValue::Text(data) => {
|
||||
std::mem::take(data)
|
||||
}
|
||||
FormValue::Text(data) => std::mem::take(data),
|
||||
FormValue::VecText(vec) => {
|
||||
vec.push(new_value);
|
||||
return
|
||||
return;
|
||||
}
|
||||
};
|
||||
let _ = o.insert(FormValue::VecText(vec![first_value, new_value]));
|
||||
|
@ -418,11 +416,10 @@ impl HasFormData for WebFormData {
|
|||
if let Ok(array) = value.dyn_into::<Array>() {
|
||||
if let Some(name) = array.get(0).as_string() {
|
||||
if let Ok(item_values) = array.get(1).dyn_into::<Array>() {
|
||||
item_values.iter()
|
||||
item_values
|
||||
.iter()
|
||||
.filter_map(|v| v.as_string())
|
||||
.for_each(|v| {
|
||||
insert_value(&mut values, name.clone(), v)
|
||||
});
|
||||
.for_each(|v| insert_value(&mut values, name.clone(), v));
|
||||
} else if let Ok(item_value) = array.get(1).dyn_into::<JsValue>() {
|
||||
insert_value(&mut values, name, item_value.as_string().unwrap());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue