1pub use querio_derive::*;
2pub use strung::prelude::*;
3pub use intuple::*;
4
5pub trait QuerioInput {
8 fn querio_input(&self) -> String;
9}
10#[derive(Intuple)]
11pub struct QuerioInputUnit;
12impl QuerioInput for QuerioInputUnit {
13 fn querio_input(&self) -> String {"".to_string()}
14}
15
16pub trait QuerioOutput {
19 const QUERIO_OUTPUT: &'static str;
20}
21
22pub struct QuerioOutputUnit;
23impl QuerioOutput for QuerioOutputUnit {
24 const QUERIO_OUTPUT: &'static str = "";
25}
26
27#[derive(Strung,Intuple)]
29pub struct QuerioVariableUnit;
30pub type QuerioSectionsUnit = StrungUnit;
31
32
33pub trait Querio {
36
37 #[cfg(feature = "native_input")]
39 type QuerioInputA: QuerioInput + IntupleStruct;
40 #[cfg(feature = "native_input")]
41 type QuerioInputB: QuerioInput + IntupleStruct;
42
43 #[cfg(feature = "variables")]
46 type QuerioVariable: Strung + IntupleStruct;
47
48 #[cfg(feature = "native_output")]
50 type QuerioOutput: QuerioOutput;
51
52 const QUERY: &'static str;
54
55 fn querio(
59 #[cfg(feature = "native_input")]
60 native_a:&Self::QuerioInputA,
61 #[cfg(feature = "native_input")]
62 native_b:&Self::QuerioInputB,
63 #[cfg(feature = "variables")]
64 hard:&Self::QuerioVariable
65 ) -> String {
66 let mut query = Self::QUERY.to_string();
67 #[cfg(feature = "native_output")]
68 {query = query.replace("<Output>",Self::QuerioOutput::QUERIO_OUTPUT);}
69 #[cfg(feature = "variables")]
70 {query = hard.strung_hashtag(&query);}
71 #[cfg(feature = "native_input")]
72 {query = query.replace("<Input>",&(native_a.querio_input()+&native_b.querio_input()));}
73 query
74 }
75 fn qrio(
77 #[cfg(feature = "native_input")]
78 native_a:<<Self as Querio>::QuerioInputA as IntupleStruct>::Intuple,
79 #[cfg(feature = "native_input")]
80 native_b:<<Self as Querio>::QuerioInputB as IntupleStruct>::Intuple,
81 #[cfg(feature = "variables")]
82 hard:<<Self as Querio>::QuerioVariable as IntupleStruct>::Intuple,
83 ) -> String { Self::querio(
84 #[cfg(feature = "native_input")]
85 &Self::QuerioInputA::from_tuple(native_a),
86 #[cfg(feature = "native_input")]
87 &Self::QuerioInputB::from_tuple(native_b),
88 #[cfg(feature = "variables")]
89 &Self::QuerioVariable::from_tuple(hard)
90 )}
91
92}