api types: BackupType: add iter for enum

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-05-03 12:39:47 +02:00
parent b6c8717cc2
commit 77337b3b4c

View File

@ -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 {