all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH proxmox] sys: fs: derive `Copy` for CreateOptions
@ 2025-01-29  9:17 Lukas Wagner
  2025-01-29 17:10 ` [pdm-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wagner @ 2025-01-29  9:17 UTC (permalink / raw)
  To: pdm-devel

Pretty much all functions accepting `CreateOptions` take a value and not
a reference, so I've found myself using `.clone()` quite often in code
I've written recently.
The struct is only 24 bytes large (verified by a
`std::mem::size_of::<CreateOptions>()`), so it should be absolutely fine
to just derive Copy for it.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 proxmox-sys/src/fs/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-sys/src/fs/mod.rs b/proxmox-sys/src/fs/mod.rs
index 4dbc3ec9..752b75d2 100644
--- a/proxmox-sys/src/fs/mod.rs
+++ b/proxmox-sys/src/fs/mod.rs
@@ -30,7 +30,7 @@ pub fn fchown(fd: RawFd, owner: Option<Uid>, group: Option<Gid>) -> Result<(), E
 }
 
 /// Define permissions, owner and group when creating files/dirs
-#[derive(Clone, Default)]
+#[derive(Copy, Clone, Default)]
 pub struct CreateOptions {
     perm: Option<stat::Mode>,
     owner: Option<Uid>,
-- 
2.39.5



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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pdm-devel] applied: [PATCH proxmox] sys: fs: derive `Copy` for CreateOptions
  2025-01-29  9:17 [pdm-devel] [PATCH proxmox] sys: fs: derive `Copy` for CreateOptions Lukas Wagner
@ 2025-01-29 17:10 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-01-29 17:10 UTC (permalink / raw)
  To: Proxmox Datacenter Manager development discussion, Lukas Wagner

Am 29.01.25 um 10:17 schrieb Lukas Wagner:
> Pretty much all functions accepting `CreateOptions` take a value and not
> a reference, so I've found myself using `.clone()` quite often in code
> I've written recently.
> The struct is only 24 bytes large (verified by a
> `std::mem::size_of::<CreateOptions>()`), so it should be absolutely fine
> to just derive Copy for it.
> 
> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
> ---
>  proxmox-sys/src/fs/mod.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-29 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-29  9:17 [pdm-devel] [PATCH proxmox] sys: fs: derive `Copy` for CreateOptions Lukas Wagner
2025-01-29 17:10 ` [pdm-devel] applied: " Thomas Lamprecht

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