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 21571787f2 - Show all commits

View File

@ -1,8 +1,9 @@
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct SourceQuestion {
#[serde(default)]
#[serde(skip_serializing_if = "u32_is_zero")]
pub num: u32,
pub id: String,
@ -13,96 +14,125 @@ pub struct SourceQuestion {
#[serde(alias = "Автор")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub author: String,
#[serde(alias = "Комментарий")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub comment: String,
#[serde(alias = "Комментарии")]
#[serde(alias = "Инфо")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub comment1: String,
#[serde(alias = "Тур")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub tour: String,
#[serde(alias = "Ссылка")]
#[serde(alias = "URL")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub url: String,
#[serde(alias = "Дата")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub date: String,
#[serde(alias = "Обработан")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub processed_by: String,
#[serde(alias = "Редактор")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub redacted_by: String,
#[serde(alias = "Копирайт")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub copyright: String,
#[serde(alias = "Тема")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub theme: String,
#[serde(alias = "Вид")]
#[serde(alias = "Тип")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub kind: String,
#[serde(alias = "Источник")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub source: String,
#[serde(alias = "Рейтинг")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub rating: String,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct SourceQuestionsBatch {
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub filename: String,
#[serde(alias = "Пакет")]
#[serde(alias = "Чемпионат")]
pub description: String,
#[serde(alias = "Автор")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub author: String,
#[serde(alias = "Комментарий")]
#[serde(alias = "Комментарии")]
#[serde(alias = "Инфо")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub comment: String,
#[serde(alias = "Ссылка")]
#[serde(alias = "URL")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub url: String,
#[serde(alias = "Дата")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub date: String,
#[serde(alias = "Обработан")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub processed_by: String,
#[serde(alias = "Редактор")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub redacted_by: String,
#[serde(alias = "Копирайт")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub copyright: String,
#[serde(alias = "Тема")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub theme: String,
#[serde(alias = "Вид")]
#[serde(alias = "Тип")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub kind: String,
#[serde(alias = "Источник")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub source: String,
#[serde(alias = "Рейтинг")]
#[serde(default)]
#[serde(skip_serializing_if = "String::is_empty")]
pub rating: String,
#[serde(alias = "Вопросы")]
pub questions: Vec<SourceQuestion>,
}
fn u32_is_zero(num: &u32) -> bool {
*num == 0
}
#[cfg(any(feature = "convert", feature = "source"))]
pub mod reader_sync {
use std::io::{Read, Seek};