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