From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 88B8A1FF130 for ; Mon, 20 Jul 2026 17:25:53 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B3AC82151B; Mon, 20 Jul 2026 17:25:49 +0200 (CEST) From: "Max R. Carrara" To: pve-devel@lists.proxmox.com Subject: [PATCH perlmod 2/4] value: implement serde::de::IntoDeserializer on Value Date: Mon, 20 Jul 2026 17:25:38 +0200 Message-ID: <20260720152541.524463-3-m.carrara@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260720152541.524463-1-m.carrara@proxmox.com> References: <20260720152541.524463-1-m.carrara@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784561120906 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.040 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: LHZ236DWKWGXJI7YGOZLGFVHJH5CKKI3 X-Message-ID-Hash: LHZ236DWKWGXJI7YGOZLGFVHJH5CKKI3 X-MailFrom: m.carrara@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: For better compatibility with serde, we implement `serde::de::IntoDeserializer` on `Value`. This allows us to skip explicitly converting to the `Value` deserializer in `perlmod::de`. Signed-off-by: Max R. Carrara --- perlmod-macro/src/function.rs | 2 +- perlmod/src/value.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/perlmod-macro/src/function.rs b/perlmod-macro/src/function.rs index 0a4cf0e..8b5d689 100644 --- a/perlmod-macro/src/function.rs +++ b/perlmod-macro/src/function.rs @@ -136,7 +136,7 @@ impl ArgumentAttrs { let _guard = ::perlmod::__private__::InParameterDeserialization::guard(); match <#arg_type as ::perlmod::__private__::serde::Deserialize>::deserialize( ::perlmod::__private__::serde::de::value::SeqDeserializer::new( - #extracted_name.map(::perlmod::de::Deserializer::<'static>::from_value) + #extracted_name ) ) { Ok(arg) => arg, diff --git a/perlmod/src/value.rs b/perlmod/src/value.rs index 1240eb5..5c2d432 100644 --- a/perlmod/src/value.rs +++ b/perlmod/src/value.rs @@ -3,6 +3,7 @@ use std::fmt; +use serde::de::IntoDeserializer; use serde::{Deserialize, Serialize}; use crate::Error; @@ -652,3 +653,11 @@ impl<'de> Deserialize<'de> for Value { } } } + +impl<'de> IntoDeserializer<'de, Error> for Value { + type Deserializer = crate::de::Deserializer<'de>; + + fn into_deserializer(self) -> Self::Deserializer { + Self::Deserializer::from_value(self) + } +} -- 2.47.3