From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 1/1] schema: serialize enum unit variants
Date: Tue, 29 Aug 2023 11:59:16 +0200 [thread overview]
Message-ID: <20230829095916.221292-3-h.laimer@proxmox.com> (raw)
In-Reply-To: <20230829095916.221292-1-h.laimer@proxmox.com>
... 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
next prev parent reply other threads:[~2023-08-29 9:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2023-09-07 15:33 ` [pbs-devel] applied: Re: [PATCH proxmox 1/1] schema: serialize enum unit variants Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230829095916.221292-3-h.laimer@proxmox.com \
--to=h.laimer@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox