mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-09 11:43:57 +01:00
24 lines
571 B
Rust
24 lines
571 B
Rust
extern crate proc_macro;
|
|
|
|
mod attr;
|
|
mod bot_commands;
|
|
mod command;
|
|
mod command_attr;
|
|
mod command_enum;
|
|
mod error;
|
|
mod fields_parse;
|
|
mod rename_rules;
|
|
mod unzip;
|
|
|
|
pub(crate) use error::{compile_error, Result};
|
|
use syn::{parse_macro_input, DeriveInput};
|
|
|
|
use crate::bot_commands::bot_commands_impl;
|
|
use proc_macro::TokenStream;
|
|
|
|
#[proc_macro_derive(BotCommands, attributes(command))]
|
|
pub fn bot_commands_derive(tokens: TokenStream) -> TokenStream {
|
|
let input = parse_macro_input!(tokens as DeriveInput);
|
|
|
|
bot_commands_impl(input).unwrap_or_else(<_>::into).into()
|
|
}
|