blob: c5358bc3834fc4bf64ea9bbf9f92b98f1b7c02d1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
use proc_macro::TokenStream;
use quote::quote;
/// Entry point for `gen_program!()`.
///
/// Generates the `Next` type alias, `Routable` impl for `ChainProcess`,
/// and delegates to `program_comp_gen!()`, `program_fallback_gen!()`,
/// and `program_final_gen!()`.
pub(crate) fn gen_program_impl(_input: TokenStream) -> TokenStream {
#[cfg(feature = "comp")]
let comp_gen = quote! {
::mingling::macros::program_comp_gen!();
};
#[cfg(not(feature = "comp"))]
let comp_gen = quote! {};
TokenStream::from(quote! {
/// Alias for the current program type `crate::ThisProgram`
pub type Next = ::mingling::ChainProcess<crate::ThisProgram>;
impl ::mingling::Routable<crate::ThisProgram> for ::mingling::ChainProcess<crate::ThisProgram>
{
fn to_chain(self) -> ::mingling::ChainProcess<crate::ThisProgram> {
match self {
::mingling::ChainProcess::Ok((any, _)) => {
::mingling::ChainProcess::Ok((any, mingling::NextProcess::Chain))
}
other => other,
}
}
fn to_render(self) -> ::mingling::ChainProcess<crate::ThisProgram> {
match self {
::mingling::ChainProcess::Ok((any, _)) => {
::mingling::ChainProcess::Ok((any, mingling::NextProcess::Renderer))
}
other => other,
}
}
}
#comp_gen
::mingling::macros::program_fallback_gen!();
::mingling::macros::program_final_gen!();
})
}
|