]> git.proxmox.com Git - proxmox-backup.git/commitdiff
api-types: make BackupType::iter an actual iterator
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 14 Jul 2022 09:09:34 +0000 (11:09 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 14 Jul 2022 09:14:26 +0000 (11:14 +0200)
Otherwise we have to use BackupType::iter().iter() whenever
we're not using a `for _ in iter()` construct.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
pbs-api-types/src/datastore.rs

index 70b639eab7459632c9f5dd47a03c2b0de0510dbd..170d248fc4e95ba43fbfbc8fa15329cf477fe3fb 100644 (file)
@@ -741,8 +741,11 @@ impl BackupType {
         }
     }
 
-    pub const fn iter() -> &'static [BackupType] {
-        &[Self::Vm, Self::Ct, Self::Host]
+    #[inline]
+    pub fn iter() -> impl Iterator<Item = BackupType> + Send + Sync + Unpin + 'static {
+        [BackupType::Vm, BackupType::Ct, BackupType::Host]
+            .iter()
+            .copied()
     }
 }