emit ::std::result::Result rather than unqualified Result

This fixes an issue where attempting to derive FromXml or ToXml
would fail if the embedding application had used something like

```
pub type Result<T> = std::result::Result<T, Error>;
```
This commit is contained in:
Wez Furlong 2024-05-22 11:00:35 -07:00 committed by Dirkjan Ochtman
parent 3e72aa7ae3
commit 5c0171b474
2 changed files with 11 additions and 11 deletions

View File

@ -84,7 +84,7 @@ fn deserialize_scalar_enum(
into: &mut Self::Accumulator, into: &mut Self::Accumulator,
field: &'static str, field: &'static str,
deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
) -> Result<(), ::instant_xml::Error> { ) -> ::std::result::Result<(), ::instant_xml::Error> {
use ::instant_xml::Error; use ::instant_xml::Error;
if into.is_some() { if into.is_some() {
@ -186,7 +186,7 @@ fn deserialize_forward_enum(
into: &mut Self::Accumulator, into: &mut Self::Accumulator,
field: &'static str, field: &'static str,
deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
) -> Result<(), ::instant_xml::Error> { ) -> ::std::result::Result<(), ::instant_xml::Error> {
use ::instant_xml::de::Node; use ::instant_xml::de::Node;
use ::instant_xml::{Accumulate, Error, FromXml}; use ::instant_xml::{Accumulate, Error, FromXml};
@ -308,7 +308,7 @@ fn deserialize_struct(
into: &mut Self::Accumulator, into: &mut Self::Accumulator,
field: &'static str, field: &'static str,
deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
) -> Result<(), ::instant_xml::Error> { ) -> ::std::result::Result<(), ::instant_xml::Error> {
use ::instant_xml::de::Node; use ::instant_xml::de::Node;
use ::instant_xml::{Accumulate, Error, FromXml, Id, Kind}; use ::instant_xml::{Accumulate, Error, FromXml, Id, Kind};
@ -495,7 +495,7 @@ fn deserialize_inline_struct(
into: &mut Self::Accumulator, into: &mut Self::Accumulator,
_: &'static str, _: &'static str,
deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
) -> Result<(), ::instant_xml::Error> { ) -> ::std::result::Result<(), ::instant_xml::Error> {
use ::instant_xml::Kind; use ::instant_xml::Kind;
let current = deserializer.parent(); let current = deserializer.parent();
@ -513,7 +513,7 @@ fn deserialize_inline_struct(
} }
impl #xml_impl_generics ::instant_xml::Accumulate<#ident #ty_generics> for #accumulator #xml_ty_generics #where_clause { impl #xml_impl_generics ::instant_xml::Accumulate<#ident #ty_generics> for #accumulator #xml_ty_generics #where_clause {
fn try_done(self, _: &'static str) -> Result<#ident #ty_generics, ::instant_xml::Error> { fn try_done(self, _: &'static str) -> ::std::result::Result<#ident #ty_generics, ::instant_xml::Error> {
Ok(#ident { Ok(#ident {
#acc_field_inits #acc_field_inits
}) })
@ -739,7 +739,7 @@ fn deserialize_tuple_struct(
into: &mut Self::Accumulator, into: &mut Self::Accumulator,
field: &'static str, field: &'static str,
deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
) -> Result<(), ::instant_xml::Error> { ) -> ::std::result::Result<(), ::instant_xml::Error> {
use ::instant_xml::de::Node; use ::instant_xml::de::Node;
use ::instant_xml::{Accumulate, Error, FromXml, Id, Kind}; use ::instant_xml::{Accumulate, Error, FromXml, Id, Kind};
@ -817,7 +817,7 @@ fn deserialize_unit_struct(input: &syn::DeriveInput, meta: &ContainerMeta) -> To
into: &mut Self::Accumulator, into: &mut Self::Accumulator,
field: &'static str, field: &'static str,
deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>, deserializer: &mut ::instant_xml::Deserializer<'cx, 'xml>,
) -> Result<(), ::instant_xml::Error> { ) -> ::std::result::Result<(), ::instant_xml::Error> {
deserializer.ignore()?; deserializer.ignore()?;
*into = Some(Self); *into = Some(Self);
Ok(()) Ok(())

View File

@ -65,7 +65,7 @@ fn serialize_scalar_enum(
&self, &self,
field: Option<::instant_xml::Id<'_>>, field: Option<::instant_xml::Id<'_>>,
serializer: &mut instant_xml::Serializer<W>, serializer: &mut instant_xml::Serializer<W>,
) -> Result<(), instant_xml::Error> { ) -> ::std::result::Result<(), instant_xml::Error> {
let prefix = match field { let prefix = match field {
Some(id) => { Some(id) => {
let prefix = serializer.write_start(id.name, #default_namespace)?; let prefix = serializer.write_start(id.name, #default_namespace)?;
@ -152,7 +152,7 @@ fn serialize_forward_enum(
&self, &self,
field: Option<::instant_xml::Id<'_>>, field: Option<::instant_xml::Id<'_>>,
serializer: &mut instant_xml::Serializer<W>, serializer: &mut instant_xml::Serializer<W>,
) -> Result<(), instant_xml::Error> { ) -> ::std::result::Result<(), instant_xml::Error> {
match self { match self {
#variants #variants
} }
@ -225,7 +225,7 @@ fn serialize_struct(
&self, &self,
field: Option<::instant_xml::Id<'_>>, field: Option<::instant_xml::Id<'_>>,
serializer: &mut instant_xml::Serializer<W>, serializer: &mut instant_xml::Serializer<W>,
) -> Result<(), instant_xml::Error> { ) -> ::std::result::Result<(), instant_xml::Error> {
// Start tag // Start tag
let prefix = serializer.write_start(#tag, #default_namespace)?; let prefix = serializer.write_start(#tag, #default_namespace)?;
@ -312,7 +312,7 @@ fn serialize_inline_struct(
&self, &self,
field: Option<::instant_xml::Id<'_>>, field: Option<::instant_xml::Id<'_>>,
serializer: &mut instant_xml::Serializer<W>, serializer: &mut instant_xml::Serializer<W>,
) -> Result<(), instant_xml::Error> { ) -> ::std::result::Result<(), instant_xml::Error> {
#body #body
Ok(()) Ok(())
} }