rrd: derive Display and FromStr for api types

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
Lukas Wagner 2024-08-22 15:13:02 +02:00 committed by Wolfgang Bumiller
parent fda2cdb7ed
commit 9426af0abf
2 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,7 @@ nix.workspace = true
serde.workspace = true
serde_cbor.workspace = true
serde_json.workspace = true
serde_plain.workspace = true
proxmox-schema = { workspace = true, features = [ "api-macro" ] }
proxmox-sys.workspace = true

View File

@ -13,6 +13,9 @@ pub enum RRDMode {
Average,
}
serde_plain::derive_display_from_serialize!(RRDMode);
serde_plain::derive_fromstr_from_deserialize!(RRDMode);
#[api]
#[derive(Copy, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
@ -31,3 +34,6 @@ pub enum RRDTimeFrame {
/// Decade (10 years)
Decade,
}
serde_plain::derive_display_from_serialize!(RRDTimeFrame);
serde_plain::derive_fromstr_from_deserialize!(RRDTimeFrame);