teloxide_macros/
lib.rs

1extern crate proc_macro;
2
3mod attr;
4mod bot_commands;
5mod command;
6mod command_attr;
7mod command_enum;
8mod error;
9mod fields_parse;
10mod rename_rules;
11mod unzip;
12
13pub(crate) use error::{compile_error, Result};
14use syn::{parse_macro_input, DeriveInput};
15
16use crate::bot_commands::bot_commands_impl;
17use proc_macro::TokenStream;
18
19#[proc_macro_derive(BotCommands, attributes(command))]
20pub fn bot_commands_derive(tokens: TokenStream) -> TokenStream {
21    let input = parse_macro_input!(tokens as DeriveInput);
22
23    bot_commands_impl(input).unwrap_or_else(<_>::into).into()
24}