From: Gabriel Goller <g.goller@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox v2 1/3] section-config: make write_section_config parameter more generic
Date: Wed, 23 Apr 2025 12:20:42 +0200 [thread overview]
Message-ID: <20250423102045.368629-2-g.goller@proxmox.com> (raw)
In-Reply-To: <20250423102045.368629-1-g.goller@proxmox.com>
The underlying function which gets called by `write_section_config` also
takes a `impl AsRef<Path>` and in some cases we do pass a path, so
taking the same parameter is better.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
proxmox-section-config/src/typed.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/proxmox-section-config/src/typed.rs b/proxmox-section-config/src/typed.rs
index 31e8e4b2e546..271bad3ad057 100644
--- a/proxmox-section-config/src/typed.rs
+++ b/proxmox-section-config/src/typed.rs
@@ -1,6 +1,7 @@
//! Support for `enum` typed section configs.
use std::collections::HashMap;
+use std::path::Path;
use anyhow::Error;
use serde::{de::DeserializeOwned, Serialize};
@@ -90,9 +91,10 @@ pub trait ApiSectionDataEntry: Sized {
}
/// Provided. Shortcut for `Self::section_config().write(filename, &data.try_into()?)`.
- fn write_section_config(filename: &str, data: &SectionConfigData<Self>) -> Result<String, Error>
+ fn write_section_config<P>(filename: P, data: &SectionConfigData<Self>) -> Result<String, Error>
where
Self: Serialize,
+ P: AsRef<Path>,
{
Self::section_config().write(filename, &data.try_into()?)
}
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-04-23 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 10:20 [pdm-devel] [PATCH proxmox{, -datacenter-manager} v2 0/4] Remove direct access to SectionConfigData<T> sections Gabriel Goller
2025-04-23 10:20 ` Gabriel Goller [this message]
2025-04-23 10:20 ` [pdm-devel] [PATCH proxmox v2 2/3] section-config: remove DerefMut and make underlying HashMap private Gabriel Goller
2025-04-23 10:20 ` [pdm-devel] [PATCH proxmox v2 3/3] section-config: add lookup and convert_to_typed_array helpers Gabriel Goller
2025-04-23 10:20 ` [pdm-devel] [PATCH proxmox-datacenter-manager v2 1/1] remotes: remove direct access on underlying sections HashMap Gabriel Goller
2025-05-06 9:56 ` [pdm-devel] applied-series: [PATCH proxmox{, -datacenter-manager} v2 0/4] Remove direct access to SectionConfigData<T> sections Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250423102045.368629-2-g.goller@proxmox.com \
--to=g.goller@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal