From d23eeb5546ba773e96ec6df8ed9b10be6c7a0520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teo=20Klestrup=20R=C3=B6ijezon?= Date: Wed, 26 Jan 2022 17:10:56 +0100 Subject: [PATCH] Use absolute path to Result in derives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #794 Signed-off-by: Teo Klestrup Röijezon --- kube-derive/src/custom_resource.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kube-derive/src/custom_resource.rs b/kube-derive/src/custom_resource.rs index 7a46623e7..ca6b166b4 100644 --- a/kube-derive/src/custom_resource.rs +++ b/kube-derive/src/custom_resource.rs @@ -51,6 +51,8 @@ struct Crates { serde: Path, #[darling(default = "Self::default_serde_json")] serde_json: Path, + #[darling(default = "Self::default_std")] + std: Path, } // Default is required when the subattribute isn't mentioned at all @@ -81,6 +83,10 @@ impl Crates { fn default_serde_json() -> Path { parse_quote! { ::serde_json } } + + fn default_std() -> Path { + parse_quote! { ::std } + } } fn default_apiext() -> String { @@ -271,7 +277,7 @@ pub(crate) fn derive(input: proc_macro2::TokenStream) -> proc_macro2::TokenStrea } } impl #serde::Serialize for #rootident { - fn serialize(&self, ser: S) -> Result { + fn serialize(&self, ser: S) -> #std::result::Result { use #serde::ser::SerializeStruct; let mut obj = ser.serialize_struct(#rootident_str, 4 + usize::from(#has_status_value))?; obj.serialize_field("apiVersion", &<#rootident as #kube_core::Resource>::api_version(&()))?;