From 15e8e95952b3a72a7f9aefcdaa6614292657ab69 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Fri, 24 Jul 2020 00:49:34 +0600 Subject: [PATCH] Generate an enumeration itself too --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a0634fb6..066b53eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,9 +28,11 @@ pub fn handler(_attr: TokenStream, item: TokenStream) -> TokenStream { #[proc_macro_attribute] pub fn bot_dialogue(_attr: TokenStream, item: TokenStream) -> TokenStream { + let item_cloned = item.clone(); let input = parse_macro_input!(item as ItemEnum); let mut dispatch_fn = "".to_owned(); + write!(dispatch_fn, "{}", item_cloned).unwrap(); write!(dispatch_fn, "impl {} {{ pub async fn dispatch(self, cx: teloxide::dispatching::UpdateWithCx) -> teloxide::dispatching::dialogue::TransitionOut {{ match self {{", input.ident).unwrap(); for variant in input.variants.iter() {