all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pdm-devel@lists.proxmox.com
Subject: Re: [pdm-devel] [PATCH proxmox 2/3] section-config: remove DerefMut and make underlying HashMap private
Date: Wed, 23 Apr 2025 11:44:29 +0200	[thread overview]
Message-ID: <u2jfoypzivo56motdf6lo43phbcytk3nbvokz6fum53366guqh@tcswqulado4d> (raw)
In-Reply-To: <oxb5xlchpajv22egin5cz5vjmkzcupmjo6gs5rjn6omh4oslj7@ocpoo2fl7pgs>

On 15.04.2025 10:42, Wolfgang Bumiller wrote:
>On Mon, Apr 14, 2025 at 02:00:44PM +0200, Gabriel Goller wrote:
>> [snip]
>> +    /// Insert a key-value pair in the section config.
>> +    ///
>> +    /// If the key does not exist in the map, it will be added to the end of
>> +    /// the order vector.
>> +    ///
>> +    /// # Returns
>> +    ///
>> +    /// * Some(value) - If the key was present, returns the previous value
>> +    /// * None - If the key was not present
>> +    pub fn insert(&mut self, key: String, value: T) -> Option<T> {
>
>Oh btw. this could be an `impl Into<String>` (or generic), that way we
>can at least avoid *some* double-clones...
>

Agree!

>> +        let previous_value = self.sections.insert(key.clone(), value);
>> +        // If there was no previous value, this is a new key, so add it to the order
>> +        if previous_value.is_none() {
>> +            self.order.push(key);
>> +        }
>> +        previous_value
>> +    }


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  reply	other threads:[~2025-04-23  9:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 12:00 [pdm-devel] [PATCH proxmox{, -datacenter-manager} 0/4] Remove direct access to SectionConfigData<T> sections Gabriel Goller
2025-04-14 12:00 ` [pdm-devel] [PATCH proxmox 1/3] section-config: make write_section_config parameter more generic Gabriel Goller
2025-04-15  6:44   ` Wolfgang Bumiller
2025-04-23  9:35     ` Gabriel Goller
2025-04-14 12:00 ` [pdm-devel] [PATCH proxmox 2/3] section-config: remove DerefMut and make underlying HashMap private Gabriel Goller
2025-04-15  8:29   ` Wolfgang Bumiller
2025-04-23  9:40     ` Gabriel Goller
2025-04-15  8:42   ` Wolfgang Bumiller
2025-04-23  9:44     ` Gabriel Goller [this message]
2025-04-14 12:00 ` [pdm-devel] [PATCH proxmox 3/3] section-config: add lookup and convert_to_typed_array helpers Gabriel Goller
2025-04-15  8:39   ` Wolfgang Bumiller
2025-04-23 10:00     ` Gabriel Goller
2025-04-14 12:00 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] remotes: remove direct access on underlying sections HashMap Gabriel Goller

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=u2jfoypzivo56motdf6lo43phbcytk3nbvokz6fum53366guqh@tcswqulado4d \
    --to=g.goller@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    --cc=w.bumiller@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal