Skip to content

Commit

Permalink
deps: bump quick-xml dependency from 0.30 to 0.31
Browse files Browse the repository at this point in the history
  • Loading branch information
decathorpe committed Jul 15, 2024
1 parent 65f629b commit f4c7e62
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dxr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ required-features = ["derive", "i8", "nil"]
dxr_derive = { workspace = true, optional = true }
base64 = "0.22"
chrono = { version = "0.4.19", features = ["std"], default-features = false }
quick-xml = { version = "0.30", features = ["serialize"] }
quick-xml = { version = "0.31", features = ["serialize"] }
serde = { version = "1.0.104", features = ["derive"] }
thiserror = "1.0.30"

Expand Down
18 changes: 14 additions & 4 deletions dxr/src/values/ser_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub(crate) mod base64 {
/// `<value><string>foo</string></value>` (which are both valid XML-RPC).
pub(crate) mod value {
use serde::{
de::{self, Deserializer, Visitor},
de::{self, Deserializer, IgnoredAny, Visitor},
Deserialize,
};
use std::fmt;
Expand Down Expand Up @@ -129,6 +129,7 @@ pub(crate) mod value {
"nil",
];

#[derive(Debug)]
enum Field {
I4,
#[cfg(feature = "i8")]
Expand Down Expand Up @@ -187,7 +188,7 @@ pub(crate) mod value {
}
}

if let Some(key) = map.next_key()? {
let value = if let Some(key) = map.next_key::<Field>()? {
match key {
Field::I4 => {
let value = map.next_value()?;
Expand Down Expand Up @@ -233,11 +234,20 @@ pub(crate) mod value {
Ok(Value::array(value))
},
#[cfg(feature = "nil")]
Field::Nil => Ok(Value::nil()),
Field::Nil => {
let _: IgnoredAny = map.next_value()?;
Ok(Value::nil())
},
}
} else {
// <value></value>
Ok(Value::string(String::new()))
return Ok(Value::string(String::new()));
};

if let Some(key) = map.next_key::<Field>()? {
Err(de::Error::custom(format!("Unexpected key: {:?}", key)))
} else {
value
}
}
}
Expand Down

0 comments on commit f4c7e62

Please sign in to comment.