blob: 8f390e68b8b673cc14ea72740da2f78f39984072 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
use proc_macro::TokenStream;
use quote::quote;
use syn::parse_macro_input;
/// Routes errors to the rendering pipeline instead of the chain pipeline.
pub(crate) fn render_route(input: TokenStream) -> TokenStream {
let expr = parse_macro_input!(input as syn::Expr);
let expanded = quote! {
match #expr {
Ok(r) => r,
Err(e) => return <crate::ThisProgram as ::mingling::ProgramCollect>::render(::mingling::AnyOutput::new(e)),
}
};
TokenStream::from(expanded)
}
|