From a9b6351737f77c742f83249e29fa76cfdf72708d Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Tue, 23 Jul 2019 21:33:03 +0000 Subject: [PATCH] Use struct instead of map for author avatar --- src/story.rs | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/story.rs b/src/story.rs index e5bdb7f..5eeae5f 100644 --- a/src/story.rs +++ b/src/story.rs @@ -1,7 +1,5 @@ //! Story meta. -use std::collections::BTreeMap; - use chrono::prelude::*; use serde::de::Error; use serde::{Deserialize, Deserializer}; @@ -53,7 +51,7 @@ pub struct Archive { #[derive(Clone, Debug, Deserialize)] pub struct Author { - pub avatar: Option>, + pub avatar: Option, pub bio_html: Option, pub date_joined: Option>, #[serde(deserialize_with = "string_to_id")] @@ -65,6 +63,34 @@ pub struct Author { pub url: String, } +#[derive(Clone, Debug, Deserialize)] +pub struct Avatar { + #[serde(rename = "16")] + pub x16: Option, + #[serde(rename = "32")] + pub x32: Option, + #[serde(rename = "48")] + pub x48: Option, + #[serde(rename = "64")] + pub x64: Option, + #[serde(rename = "96")] + pub x96: Option, + #[serde(rename = "128")] + pub x128: Option, + #[serde(rename = "160")] + pub x160: Option, + #[serde(rename = "192")] + pub x192: Option, + #[serde(rename = "256")] + pub x256: Option, + #[serde(rename = "320")] + pub x320: Option, + #[serde(rename = "384")] + pub x384: Option, + #[serde(rename = "512")] + pub x512: Option, +} + #[derive(Clone, Debug, Deserialize)] pub struct Chapter { pub chapter_number: i32,