From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 4EEE71FF187 for ; Tue, 2 Dec 2025 15:32:35 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A146C148C6; Tue, 2 Dec 2025 15:33:00 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Tue, 2 Dec 2025 15:31:02 +0100 Message-ID: <20251202143226.3681712-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251202143226.3681712-1-d.csapak@proxmox.com> References: <20251202143226.3681712-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH yew-comp 1/2] subscription check: use more useful function signature X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" having a reference of an option is very unweildly at times, e.g. when having the inner type, it's necessary to move it into an option, even if `subscription_is_active` does not need to own the data. using an option of a reference makes usage much more ergonomic at times. Signed-off-by: Dominik Csapak --- NOTE: this breaks current pdm, as it changes a public function signature. Fix for pdm is the first datacenter manger patch. src/apt_package_manager.rs | 2 +- src/apt_repositories.rs | 2 +- src/subscription_alert.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apt_package_manager.rs b/src/apt_package_manager.rs index 0b4ae2e..b419957 100644 --- a/src/apt_package_manager.rs +++ b/src/apt_package_manager.rs @@ -198,7 +198,7 @@ impl LoadableComponent for ProxmoxAptPackageManager { let command = format!("{}/update", props.base_url); self.async_pool.spawn(async move { let data = crate::http_get::(url.as_str(), None).await; - let is_active = subscription_is_active(&Some(data)); + let is_active = subscription_is_active(Some(&data)); if is_active { link.task_base_url(task_base_url); diff --git a/src/apt_repositories.rs b/src/apt_repositories.rs index 9ab8258..7157c0c 100644 --- a/src/apt_repositories.rs +++ b/src/apt_repositories.rs @@ -705,7 +705,7 @@ fn standard_repo_info( impl ProxmoxAptRepositories { fn active_subscription(&self) -> bool { - subscription_is_active(&self.subscription_status) + subscription_is_active(self.subscription_status.as_ref()) } fn create_show_subscription_dialog( diff --git a/src/subscription_alert.rs b/src/subscription_alert.rs index 7734123..496d258 100644 --- a/src/subscription_alert.rs +++ b/src/subscription_alert.rs @@ -68,7 +68,7 @@ impl From for VNode { } /// Check if the result of the subscription check returned an active subscription -pub fn subscription_is_active(result: &Option>) -> bool { +pub fn subscription_is_active(result: Option<&Result>) -> bool { match result { Some(Ok(data)) => { data["status"].as_str().map(|s| s.to_lowercase()).as_deref() == Some("active") -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel