mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
xml: Differentiate between ValueSerialize and ValueDeserialize to prevent unwraps
This commit is contained in:
@@ -232,7 +232,7 @@ impl Field {
|
||||
let builder_field_ident = self.builder_field_ident();
|
||||
let value = wrap_option_if_no_default(
|
||||
quote! {
|
||||
rustical_xml::Value::deserialize(text.as_ref())?
|
||||
::rustical_xml::ValueDeserialize::deserialize(text.as_ref())?
|
||||
},
|
||||
self.attrs.default.is_some(),
|
||||
);
|
||||
@@ -250,8 +250,8 @@ impl Field {
|
||||
|
||||
let value = wrap_option_if_no_default(
|
||||
quote! {
|
||||
rustical_xml::Value::deserialize(attr.unescape_value()?.as_ref())?
|
||||
},
|
||||
::rustical_xml::ValueDeserialize::deserialize(attr.unescape_value()?.as_ref())?
|
||||
},
|
||||
self.attrs.default.is_some(),
|
||||
);
|
||||
|
||||
@@ -270,7 +270,7 @@ impl Field {
|
||||
|
||||
let value = wrap_option_if_no_default(
|
||||
quote! {
|
||||
rustical_xml::Value::deserialize(&String::from_utf8_lossy(name.as_ref()))?
|
||||
rustical_xml::ValueDeserialize::deserialize(&String::from_utf8_lossy(name.as_ref()))?
|
||||
},
|
||||
self.attrs.default.is_some(),
|
||||
);
|
||||
|
||||
@@ -239,7 +239,7 @@ impl NamedStruct {
|
||||
quote! {
|
||||
::quick_xml::events::attributes::Attribute {
|
||||
key: ::quick_xml::name::QName(#field_name),
|
||||
value: ::std::borrow::Cow::from(::rustical_xml::Value::serialize(&self.#field_index).into_bytes())
|
||||
value: ::std::borrow::Cow::from(::rustical_xml::ValueSerialize::serialize(&self.#field_index).into_bytes())
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user