From f64272b9484e8f264082ffe5a423d45bdd4db9fa Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 3 May 2022 12:39:47 +0200 Subject: [PATCH] api types: BackupType: add iter for enum Signed-off-by: Thomas Lamprecht --- pbs-api-types/src/datastore.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index e0b900d9..0500e85c 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -439,6 +439,7 @@ pub enum BackupType { /// "Host" backups. Host, + // NOTE: if you add new types, don't forget to adapt the iter below! } impl BackupType { @@ -458,6 +459,10 @@ impl BackupType { BackupType::Vm => 2, } } + + pub const fn iter() -> &'static [BackupType] { + &[Self::Vm, Self::Ct, Self::Host] + } } impl fmt::Display for BackupType {