mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
add tengri_core; fix errors and warnings; unify deps
This commit is contained in:
parent
cb8fd26922
commit
8dda576c9d
18 changed files with 180 additions and 152 deletions
|
|
@ -8,7 +8,8 @@ edition = { workspace = true }
|
|||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
syn = { version = "2", features = ["full", "extra-traits"] }
|
||||
quote = { version = "1" }
|
||||
proc-macro2 = { version = "1", features = ["span-locations"] }
|
||||
heck = { version = "0.5" }
|
||||
tengri_core = { path = "../core" }
|
||||
syn = { workspace = true }
|
||||
quote = { workspace = true }
|
||||
proc-macro2 = { workspace = true }
|
||||
heck = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -10,10 +10,7 @@ pub(crate) struct CommandMeta(Ident);
|
|||
pub(crate) struct CommandImpl(ItemImpl, BTreeMap<Arc<str>, CommandArm>);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct CommandArm(Ident, Vec<FnArg>, ReturnType);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct CommandVariant(Ident, Vec<FnArg>);
|
||||
struct CommandArm(Ident, Vec<FnArg>, #[allow(unused)] ReturnType);
|
||||
|
||||
impl Parse for CommandMeta {
|
||||
fn parse (input: ParseStream) -> Result<Self> {
|
||||
|
|
@ -203,25 +200,3 @@ impl CommandArm {
|
|||
write_quote(quote! { Self::#variant => Self::#ident(state, #(#give_args)* #give_rest), })
|
||||
}
|
||||
}
|
||||
|
||||
impl ToTokens for CommandVariant {
|
||||
fn to_tokens (&self, out: &mut TokenStream2) {
|
||||
let Self(ident, args) = self;
|
||||
out.append(LitStr::new(&format!("{}", ident), Span::call_site())
|
||||
.token());
|
||||
out.append(Group::new(Delimiter::Parenthesis, {
|
||||
let mut out = TokenStream2::new();
|
||||
for arg in args.iter() {
|
||||
if let FnArg::Typed(PatType { ty, .. }) = arg {
|
||||
out.append(LitStr::new(
|
||||
&format!("{}", quote! { #ty }),
|
||||
Span::call_site()
|
||||
).token());
|
||||
out.append(Punct::new(',', Alone));
|
||||
}
|
||||
}
|
||||
out
|
||||
}));
|
||||
out.append(Punct::new(',', Alone));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue