* [pbs-devel] [PATCH proxmox/proxmox-backup 0/2] use new proxmox_schema:de
@ 2023-08-29 9:59 Hannes Laimer
2023-08-29 9:59 ` [pbs-devel] [PATCH proxmox-backup 1/1] pbs-api-types: datastore: use new proxmox_scheme::de for deserialization Hannes Laimer
2023-08-29 9:59 ` [pbs-devel] [PATCH proxmox 1/1] schema: serialize enum unit variants Hannes Laimer
0 siblings, 2 replies; 4+ messages in thread
From: Hannes Laimer @ 2023-08-29 9:59 UTC (permalink / raw)
To: pbs-devel
Sice deserializing enum unit variants already works it made sense to
also serialize them.
Hannes Laimer (1):
schema: serialize enum unit variants
proxmox-schema/src/ser/mod.rs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Hannes Laimer (1):
pbs-api-types: datastore: use new proxmox_scheme::de for
deserialization
pbs-api-types/src/datastore.rs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 1/1] pbs-api-types: datastore: use new proxmox_scheme::de for deserialization
2023-08-29 9:59 [pbs-devel] [PATCH proxmox/proxmox-backup 0/2] use new proxmox_schema:de Hannes Laimer
@ 2023-08-29 9:59 ` Hannes Laimer
2023-08-29 9:59 ` [pbs-devel] [PATCH proxmox 1/1] schema: serialize enum unit variants Hannes Laimer
1 sibling, 0 replies; 4+ messages in thread
From: Hannes Laimer @ 2023-08-29 9:59 UTC (permalink / raw)
To: pbs-devel
... of maintenance mode
Signed-off-by: Hannes Laimer <h.laimer@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 a796bf46..497627ef 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] [PATCH proxmox 1/1] schema: serialize enum unit variants
2023-08-29 9:59 [pbs-devel] [PATCH proxmox/proxmox-backup 0/2] use new proxmox_schema:de Hannes Laimer
2023-08-29 9:59 ` [pbs-devel] [PATCH proxmox-backup 1/1] pbs-api-types: datastore: use new proxmox_scheme::de for deserialization Hannes Laimer
@ 2023-08-29 9:59 ` Hannes Laimer
2023-09-07 15:33 ` [pbs-devel] applied: " Thomas Lamprecht
1 sibling, 1 reply; 4+ messages in thread
From: Hannes Laimer @ 2023-08-29 9:59 UTC (permalink / raw)
To: pbs-devel
... since deserializing them already works
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
proxmox-schema/src/ser/mod.rs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/proxmox-schema/src/ser/mod.rs b/proxmox-schema/src/ser/mod.rs
index 3dad6d6..e19209a 100644
--- a/proxmox-schema/src/ser/mod.rs
+++ b/proxmox-schema/src/ser/mod.rs
@@ -483,14 +483,13 @@ impl<T: fmt::Write> Serializer for ElementSerializer<T> {
}
fn serialize_unit_variant(
- self,
- name: &'static str,
+ mut self,
+ _name: &'static str,
_index: u32,
variant: &'static str,
) -> Result<Self::Ok, Error> {
- Err(Error::msg(format!(
- "tried to serialize a unit variant ({name}::{variant})"
- )))
+ self.inner.write_str(variant)?;
+ Ok(self.inner)
}
fn serialize_newtype_struct<V>(self, _name: &'static str, value: &V) -> Result<T, Error>
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-07 15:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29 9:59 [pbs-devel] [PATCH proxmox/proxmox-backup 0/2] use new proxmox_schema:de Hannes Laimer
2023-08-29 9:59 ` [pbs-devel] [PATCH proxmox-backup 1/1] pbs-api-types: datastore: use new proxmox_scheme::de for deserialization Hannes Laimer
2023-08-29 9:59 ` [pbs-devel] [PATCH proxmox 1/1] schema: serialize enum unit variants Hannes Laimer
2023-09-07 15:33 ` [pbs-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox