From 919d8fffbaf42ef5f82497d41b68427a947af688 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Fri, 5 Apr 2024 13:42:28 +0700 Subject: [PATCH] Changes to serde --- crates/core/src/bc/xml.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/core/src/bc/xml.rs b/crates/core/src/bc/xml.rs index 8ff82ed4..4a56e34e 100644 --- a/crates/core/src/bc/xml.rs +++ b/crates/core/src/bc/xml.rs @@ -126,7 +126,7 @@ impl BcXml { .write_event(quick_xml::events::Event::Decl( quick_xml::events::BytesDecl::new("1.0", Some("UTF-8"), None), )) - .expect("Should be aboe to serialise a basic xml declation"); + .expect("Should be able to serialise a basic xml declaration"); writer.write_serializable("body", &self)?; Ok(w) } @@ -136,14 +136,14 @@ impl Extension { pub(crate) fn try_parse(s: impl BufRead) -> Result { quick_xml::de::from_reader(s) } - pub(crate) fn serialize(&self, mut w: W) -> Result { + pub(crate) fn serialize(&self, mut w: W) -> Result { let mut writer = quick_xml::writer::Writer::new(&mut w); - writer.write_event(quick_xml::events::Event::Decl( - quick_xml::events::BytesDecl::new("1.0", Some("UTF-8"), None), - ))?; writer - .write_serializable("body", &self) - .expect("Should be serialisable"); + .write_event(quick_xml::events::Event::Decl( + quick_xml::events::BytesDecl::new("1.0", Some("UTF-8"), None), + )) + .expect("Should be able to serialise a basic xml declaration"); + writer.write_serializable("Extension", &self)?; Ok(w) } } @@ -271,6 +271,7 @@ pub struct Preview { /// /// This is used to describe the subsequent payload passed the `payload_offset` #[derive(PartialEq, Eq, Debug, Deserialize, Serialize)] +#[serde(rename = "Extension")] pub struct Extension { /// XML Version #[serde(rename = "@version")]