mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
Generate an enumeration itself too
This commit is contained in:
parent
a18ef6fc94
commit
15e8e95952
1 changed files with 2 additions and 0 deletions
|
@ -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::types::Message>) -> teloxide::dispatching::dialogue::TransitionOut<Self> {{ match self {{", input.ident).unwrap();
|
||||
|
||||
for variant in input.variants.iter() {
|
||||
|
|
Loading…
Reference in a new issue