Skip to content

Commit

Permalink
cargo, src: Update quick-xml from 0.23.0 to 0.30.0
Browse files Browse the repository at this point in the history
The library changed its serialization behavior. Now, we need to specify
when we want a structure field to be serialized as a parameter (as in
`<tag parameter="value"/>`) instead of the sub-tags (as in
`<tag><subtag>value<subtag/></tag>`), which is the default.
  • Loading branch information
joaoantoniocardoso authored and patrickelectric committed Sep 26, 2023
1 parent 67be8ce commit 0fad7dd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lazy_static = "1.4.0"
include_dir = "0.7.3"
paperclip = { version = "0.8", features = ["paperclip-actix", "actix4", "swagger-ui", "url", "uuid"] }
#TODO: Replace it with yaserde
quick-xml = { version = "0.23.0", features = ["serialize"] }
quick-xml = { version = "0.30.0", features = ["serialize"] }
url = { version = "2.4.1", features = ["serde"] }
v4l = "0.14.0"
directories = "5.0.1"
Expand Down
21 changes: 18 additions & 3 deletions src/video/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct MavlinkCamera {

#[derive(Debug, Serialize)]
pub struct Definition {
#[serde(rename = "@version")]
pub version: u32,
pub model: Model,
pub vendor: Vendor,
Expand Down Expand Up @@ -56,33 +57,45 @@ pub enum ParameterType {

#[derive(Debug, Serialize)]
pub struct ParameterBool {
#[serde(rename = "@name")]
pub name: String,
#[serde(rename = "type")]
#[serde(rename = "@type")]
pub cpp_type: String,
#[serde(rename = "@default")]
pub default: i64,
#[serde(rename = "@v4l_id")]
pub v4l_id: u64,
pub description: Description,
}

#[derive(Debug, Serialize)]
pub struct ParameterSlider {
#[serde(rename = "@name")]
pub name: String,
#[serde(rename = "type")]
#[serde(rename = "@type")]
pub cpp_type: String,
#[serde(rename = "@default")]
pub default: i64,
#[serde(rename = "@v4l_id")]
pub v4l_id: u64,
#[serde(rename = "@step")]
pub step: u64,
#[serde(rename = "@max")]
pub max: i64,
#[serde(rename = "@min")]
pub min: i64,
pub description: Description,
}

#[derive(Debug, Serialize)]
pub struct ParameterMenu {
#[serde(rename = "@name")]
pub name: String,
#[serde(rename = "type")]
#[serde(rename = "@type")]
pub cpp_type: String,
#[serde(rename = "@default")]
pub default: i64,
#[serde(rename = "@v4l_id")]
pub v4l_id: u64,
pub description: Description,
pub options: Options,
Expand All @@ -95,7 +108,9 @@ pub struct Options {

#[derive(Debug, Serialize)]
pub struct Option {
#[serde(rename = "@name")]
pub name: String,
#[serde(rename = "@value")]
pub value: i64,
}

Expand Down

0 comments on commit 0fad7dd

Please sign in to comment.