mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-08 19:33:53 +01:00
Merge pull request #27 from teloxide/fix-parse-with-path
Allow specifying a path to a command handler in `parse_with`
This commit is contained in:
commit
4274eeeba9
2 changed files with 9 additions and 3 deletions
|
@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Allow specifying a path to a command handler in `parse_with` ([PR #27](https://github.com/teloxide/teloxide-macros/pull/27)).
|
||||
|
||||
## 0.6.2 - 2022-05-27
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
extern crate quote;
|
||||
|
||||
use quote::{__private::Span, quote, ToTokens};
|
||||
use quote::{quote, ToTokens};
|
||||
use syn::{FieldsNamed, FieldsUnnamed, Type};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -89,8 +89,10 @@ fn create_parser<'a>(
|
|||
count_args,
|
||||
),
|
||||
ParserType::Custom(s) => {
|
||||
let ident = syn::Ident::new(s, Span::call_site());
|
||||
quote! { #ident }
|
||||
let path = syn::parse_str::<syn::Path>(s).unwrap_or_else(|_| {
|
||||
panic!("Failed to parse a custom command parser, {}", s)
|
||||
});
|
||||
quote! { #path }
|
||||
}
|
||||
};
|
||||
quote! {
|
||||
|
|
Loading…
Reference in a new issue