add async feature #1

Merged
b4tman merged 62 commits from async into master 2023-08-18 06:29:46 +00:00
Showing only changes of commit e32316c6aa - Show all commits

View File

@ -2,8 +2,7 @@ use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)] #[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct SourceQuestion { pub struct SourceQuestion {
#[serde(default)] #[serde(default, skip_serializing_if = "u32_is_zero")]
#[serde(skip_serializing_if = "u32_is_zero")]
pub num: u32, pub num: u32,
pub id: String, pub id: String,
@ -12,118 +11,96 @@ pub struct SourceQuestion {
#[serde(alias = "Ответ")] #[serde(alias = "Ответ")]
pub answer: String, pub answer: String,
#[serde(alias = "Автор")] #[serde(alias = "Автор", default, skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub author: String, pub author: String,
#[serde(alias = "Комментарий")] #[serde(
#[serde(default)] default,
#[serde(skip_serializing_if = "String::is_empty")] alias = "Комментарий",
skip_serializing_if = "String::is_empty"
)]
pub comment: String, pub comment: String,
#[serde(alias = "Комментарии")] #[serde(
#[serde(alias = "Инфо")] default,
#[serde(default)] alias = "Комментарии",
#[serde(skip_serializing_if = "String::is_empty")] alias = "Инфо",
skip_serializing_if = "String::is_empty"
)]
pub comment1: String, pub comment1: String,
#[serde(alias = "Тур")] #[serde(default, alias = "Тур", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub tour: String, pub tour: String,
#[serde(alias = "Ссылка")] #[serde(
#[serde(alias = "URL")] default,
#[serde(default)] alias = "Ссылка",
#[serde(skip_serializing_if = "String::is_empty")] alias = "URL",
skip_serializing_if = "String::is_empty"
)]
pub url: String, pub url: String,
#[serde(alias = "Дата")] #[serde(default, alias = "Дата", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub date: String, pub date: String,
#[serde(alias = "Обработан")] #[serde(default, alias = "Обработан", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub processed_by: String, pub processed_by: String,
#[serde(alias = "Редактор")] #[serde(default, alias = "Редактор", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub redacted_by: String, pub redacted_by: String,
#[serde(alias = "Копирайт")] #[serde(default, alias = "Копирайт", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub copyright: String, pub copyright: String,
#[serde(alias = "Тема")] #[serde(default, alias = "Тема", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub theme: String, pub theme: String,
#[serde(alias = "Вид")] #[serde(
#[serde(alias = "Тип")] default,
#[serde(default)] alias = "Вид",
#[serde(skip_serializing_if = "String::is_empty")] alias = "Тип",
skip_serializing_if = "String::is_empty"
)]
pub kind: String, pub kind: String,
#[serde(alias = "Источник")] #[serde(default, alias = "Источник", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub source: String, pub source: String,
#[serde(alias = "Рейтинг")] #[serde(default, alias = "Рейтинг", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub rating: String, pub rating: String,
} }
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)] #[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct SourceQuestionsBatch { pub struct SourceQuestionsBatch {
#[serde(default)] #[serde(default, skip_serializing_if = "String::is_empty")]
#[serde(skip_serializing_if = "String::is_empty")]
pub filename: String, pub filename: String,
#[serde(alias = "Пакет")] #[serde(alias = "Пакет", alias = "Чемпионат")]
#[serde(alias = "Чемпионат")]
pub description: String, pub description: String,
#[serde(alias = "Автор")] #[serde(default, alias = "Автор", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub author: String, pub author: String,
#[serde(alias = "Комментарий")] #[serde(
#[serde(alias = "Комментарии")] default,
#[serde(alias = "Инфо")] alias = "Комментарий",
#[serde(default)] alias = "Комментарии",
#[serde(skip_serializing_if = "String::is_empty")] alias = "Инфо",
skip_serializing_if = "String::is_empty"
)]
pub comment: String, pub comment: String,
#[serde(alias = "Ссылка")] #[serde(
#[serde(alias = "URL")] default,
#[serde(default)] alias = "Ссылка",
#[serde(skip_serializing_if = "String::is_empty")] alias = "URL",
skip_serializing_if = "String::is_empty"
)]
pub url: String, pub url: String,
#[serde(alias = "Дата")] #[serde(default, alias = "Дата", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub date: String, pub date: String,
#[serde(alias = "Обработан")] #[serde(default, alias = "Обработан", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub processed_by: String, pub processed_by: String,
#[serde(alias = "Редактор")] #[serde(default, alias = "Редактор", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub redacted_by: String, pub redacted_by: String,
#[serde(alias = "Копирайт")] #[serde(default, alias = "Копирайт", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub copyright: String, pub copyright: String,
#[serde(alias = "Тема")] #[serde(default, alias = "Тема", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub theme: String, pub theme: String,
#[serde(alias = "Вид")] #[serde(
#[serde(alias = "Тип")] default,
#[serde(default)] alias = "Вид",
#[serde(skip_serializing_if = "String::is_empty")] alias = "Тип",
skip_serializing_if = "String::is_empty"
)]
pub kind: String, pub kind: String,
#[serde(alias = "Источник")] #[serde(default, alias = "Источник", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub source: String, pub source: String,
#[serde(alias = "Рейтинг")] #[serde(default, alias = "Рейтинг", skip_serializing_if = "String::is_empty")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub rating: String, pub rating: String,
#[serde(alias = "Вопросы")] #[serde(alias = "Вопросы")]
pub questions: Vec<SourceQuestion>, pub questions: Vec<SourceQuestion>,