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 150527efeb - Show all commits

View File

@ -1,14 +1,5 @@
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
macro_rules! make {
($Target:ident; by {$($field:ident),+}; from $src:expr) => {$Target {$(
$field: $src.$field
),+}};
($Target:ident; with defaults and by {$($field:ident),+}; from $src:expr) => {$Target {$(
$field: $src.$field
),+ ,..$Target::default()}}
}
#[derive(Debug, Default, Clone, Serialize, Deserialize, bincode::Decode, bincode::Encode)] #[derive(Debug, Default, Clone, Serialize, Deserialize, bincode::Decode, bincode::Encode)]
pub struct BatchInfo { pub struct BatchInfo {
#[serde(default)] #[serde(default)]
@ -80,9 +71,17 @@ pub struct Question {
#[cfg(feature = "source")] #[cfg(feature = "source")]
pub mod convert { pub mod convert {
use super::{BatchInfo, Question};
use crate::source::{SourceQuestion, SourceQuestionsBatch}; use crate::source::{SourceQuestion, SourceQuestionsBatch};
use super::{BatchInfo, Question}; macro_rules! make {
($Target:ident; by {$($field:ident),+}; from $src:expr) => {$Target {$(
$field: $src.$field
),+}};
($Target:ident; with defaults and by {$($field:ident),+}; from $src:expr) => {$Target {$(
$field: $src.$field
),+ ,..$Target::default()}}
}
impl From<SourceQuestion> for Question { impl From<SourceQuestion> for Question {
fn from(src: SourceQuestion) -> Self { fn from(src: SourceQuestion) -> Self {