This commit is contained in:
David Pedersen
2022-02-10 16:46:42 +01:00
parent 1e51ea9423
commit b42ccc8eda
4 changed files with 188 additions and 1 deletions
+7
View File
@@ -49,6 +49,7 @@ use syn::parse::Parse;
mod debug_handler;
mod from_request;
mod route;
/// Derive an implementation of [`FromRequest`].
///
@@ -385,6 +386,12 @@ pub fn debug_handler(_attr: TokenStream, input: TokenStream) -> TokenStream {
return expand_attr_with(_attr, input, debug_handler::expand);
}
/// TODO
#[proc_macro_derive(Route, attributes(route))]
pub fn derive_route(input: TokenStream) -> TokenStream {
expand_with(input, route::expand)
}
fn expand_with<F, I, K>(input: TokenStream, f: F) -> TokenStream
where
F: FnOnce(I) -> syn::Result<K>,