Skip to content

Commit

Permalink
Add Serialize to all structs
Browse files Browse the repository at this point in the history
  • Loading branch information
snpefk committed Sep 24, 2024
1 parent 729e233 commit 895f1ad
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions crates/opensi-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::ErrorKind;
use std::path::Path;
use std::{fs::File, io, io::Read};

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Package {
pub id: String,
pub name: Option<String>,
Expand All @@ -22,27 +22,27 @@ pub struct Package {
pub info: Info,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Info {
pub comments: Option<String>,
pub extension: Option<String>,
pub authors: Authors,
pub sources: Option<Vec<String>>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Authors {
#[serde(rename = "author", default)]
pub authors: Vec<String>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Rounds {
#[serde(rename = "round", default)]
pub rounds: Vec<Round>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Round {
pub name: String,
#[serde(rename = "type", default)]
Expand All @@ -51,26 +51,26 @@ pub struct Round {
pub themes: Themes,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Themes {
#[serde(rename = "theme", default)]
pub themes: Vec<Theme>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Theme {
pub name: String,
pub questions: Questions,
pub info: Option<Info>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Questions {
#[serde(rename = "question", default)]
pub questions: Vec<Question>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Question {
pub price: usize,
pub scenario: Scenario,
Expand All @@ -81,36 +81,36 @@ pub struct Question {
pub info: Option<Info>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Variant {
pub name: String,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Scenario {
#[serde(rename = "atom", default)]
pub atoms: Vec<Atom>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Right {
#[serde(rename = "answer", default)]
pub answers: Vec<Answer>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Wrong {
#[serde(rename = "answer", default)]
pub answers: Vec<Answer>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Answer {
#[serde(rename = "$value")]
pub body: Option<String>,
}

#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Atom {
pub time: Option<f64>,
#[serde(rename = "type", default)]
Expand Down

0 comments on commit 895f1ad

Please sign in to comment.