[pdm-devel] [PATCH proxmox] sys: fs: derive `Copy` for CreateOptions
Lukas Wagner
l.wagner at proxmox.com
Wed Jan 29 10:17:39 CET 2025
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 at 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
More information about the pdm-devel
mailing list