mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 19:56:44 +01:00
proc: allow implementing #[command] over more complex types
This commit is contained in:
parent
921378b6db
commit
7ddbace030
2 changed files with 3 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ pub(crate) use proc_macro2::{
|
|||
TokenStream as TokenStream2, Ident, Span, Punct, Group, Delimiter, Spacing::*
|
||||
};
|
||||
pub(crate) use syn::{
|
||||
parse_macro_input, ImplItem, ImplItemFn, LitStr, Type,
|
||||
parse_macro_input, ImplItem, ImplItemFn, LitStr, Type, TypePath,
|
||||
ItemImpl, ReturnType, Signature, FnArg, Pat, PatType, PatIdent,
|
||||
parse::{Parse, ParseStream, Result},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use crate::*;
|
|||
pub(crate) struct CommandDef(pub(crate) CommandMeta, pub(crate) CommandImpl);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct CommandMeta(Ident);
|
||||
pub(crate) struct CommandMeta(TypePath);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct CommandImpl(ItemImpl, BTreeMap<Arc<str>, CommandArm>);
|
||||
|
|
@ -14,7 +14,7 @@ struct CommandArm(Ident, Vec<FnArg>, #[allow(unused)] ReturnType);
|
|||
|
||||
impl Parse for CommandMeta {
|
||||
fn parse (input: ParseStream) -> Result<Self> {
|
||||
Ok(Self(input.parse::<Ident>()?))
|
||||
Ok(Self(input.parse()?))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue