Skip to content

Commit

Permalink
feat: derive debug for all models (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
kade-robertson authored Jan 20, 2023
1 parent 53672fd commit 9b4aad7
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/Cargo.lock
.vscode
10 changes: 5 additions & 5 deletions src/models/challenges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};

pub type Challenges = Vec<Challenge>;

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Challenge {
pub id: i64,
pub name: String,
Expand All @@ -16,7 +16,7 @@ pub struct Challenge {
pub thresholds: Thresholds,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct LevelToIconPath {
#[serde(rename = "IRON")]
pub iron: Option<String>,
Expand All @@ -38,7 +38,7 @@ pub struct LevelToIconPath {
pub challenger: Option<String>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Thresholds {
#[serde(rename = "IRON")]
pub iron: Option<RankReward>,
Expand All @@ -60,13 +60,13 @@ pub struct Thresholds {
pub challenger: Option<RankReward>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct RankReward {
pub value: i64,
pub rewards: Option<Vec<RewardDetails>>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct RewardDetails {
pub category: String,
pub quantity: i64,
Expand Down
10 changes: 5 additions & 5 deletions src/models/champions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use std::collections::HashMap;

use super::shared::Image;

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Champions {
pub format: String,
pub version: String,
pub data: HashMap<String, ChampionData>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct ChampionData {
pub version: String,
pub id: String,
Expand All @@ -25,15 +25,15 @@ pub struct ChampionData {
pub stats: HashMap<String, f64>,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub struct Info {
pub attack: i64,
pub defense: i64,
pub magic: i64,
pub difficulty: i64,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum ChampionSprite {
#[serde(rename = "champion0.png")]
Champion0,
Expand All @@ -49,7 +49,7 @@ pub enum ChampionSprite {
Champion5,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum Tag {
Assassin,
Fighter,
Expand Down
22 changes: 7 additions & 15 deletions src/models/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,23 @@ use std::collections::HashMap;

use super::shared::Image;

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Items {
pub version: String,
pub data: HashMap<String, Item>,
pub groups: Vec<Group>,
pub tree: Vec<Tree>,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub struct Gold {
pub base: i64,
pub total: i64,
pub sell: i64,
pub purchasable: bool,
}

#[derive(Serialize, Deserialize, Clone)]
pub struct Rune {
pub isrune: bool,
pub tier: i64,
#[serde(rename = "type")]
pub rune_type: String,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Item {
pub name: String,
pub description: String,
Expand Down Expand Up @@ -58,7 +50,7 @@ pub struct Item {
pub special_recipe: Option<i64>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Effect {
#[serde(rename = "Effect1Amount")]
pub effect1_amount: String,
Expand Down Expand Up @@ -98,20 +90,20 @@ pub struct Effect {
pub effect18_amount: Option<String>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Group {
pub id: String,
#[serde(rename = "MaxGroupOwnable")]
pub max_group_ownable: String,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Tree {
pub header: String,
pub tags: Vec<String>,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum ItemSprite {
#[serde(rename = "item0.png")]
Item0,
Expand Down
6 changes: 3 additions & 3 deletions src/models/runes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
pub type Runes = Vec<Rune>;

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Rune {
pub id: i64,
pub key: String,
Expand All @@ -10,12 +10,12 @@ pub struct Rune {
pub slots: Vec<Slot>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Slot {
pub runes: Vec<RuneElement>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct RuneElement {
pub id: i64,
pub key: String,
Expand Down
2 changes: 1 addition & 1 deletion src/models/shared.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Image<T: Clone> {
pub full: String,
pub sprite: T,
Expand Down
10 changes: 5 additions & 5 deletions src/models/summoner_spells.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use std::collections::HashMap;

use super::shared::Image;

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct SummonerSpells {
pub version: String,
pub data: HashMap<String, SummonerSpell>,
}

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct SummonerSpell {
pub id: String,
pub name: String,
Expand Down Expand Up @@ -39,21 +39,21 @@ pub struct SummonerSpell {
pub resource: CostType,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum CostType {
#[serde(rename = "&nbsp;")]
Nbsp,
#[serde(rename = "No Cost")]
NoCost,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum Group {
#[serde(rename = "spell")]
Spell,
}

#[derive(Serialize, Deserialize, Clone, Copy)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum SummonerSpellSprite {
#[serde(rename = "spell0.png")]
Spell0Png,
Expand Down
2 changes: 1 addition & 1 deletion src/models/translations.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[derive(Serialize, Deserialize, Clone)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Translations {
pub version: String,
pub data: HashMap<String, String>,
Expand Down

0 comments on commit 9b4aad7

Please sign in to comment.