[pbs-devel] [PATCH proxmox-backup v2 12/25] pbs-api-types: datastore: use new proxmox_scheme::de for deserialization
Hannes Laimer
h.laimer at proxmox.com
Thu Sep 21 14:51:54 CEST 2023
Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
pbs-api-types/src/datastore.rs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index 5464ce69..f52136d0 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -341,10 +341,13 @@ impl DataStoreConfig {
}
pub fn get_maintenance_mode(&self) -> Option<MaintenanceMode> {
- self.maintenance_mode
- .as_ref()
- .and_then(|str| MaintenanceMode::API_SCHEMA.parse_property_string(str).ok())
- .and_then(|value| MaintenanceMode::deserialize(value).ok())
+ self.maintenance_mode.as_ref().and_then(|str| {
+ MaintenanceMode::deserialize(proxmox_schema::de::SchemaDeserializer::new(
+ str,
+ &MaintenanceMode::API_SCHEMA,
+ ))
+ .ok()
+ })
}
pub fn set_maintenance_mode(&mut self, mode: Option<MaintenanceMode>) {
--
2.39.2
More information about the pbs-devel
mailing list