From 2fa57984de50cd6da95fd9cdede49feb134f7260 Mon Sep 17 00:00:00 2001 From: Jerome Date: Tue, 27 Aug 2024 01:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8F=96`ssrkit-macros`=EF=BC=8C?= =?UTF-8?q?=E7=8D=A8=E7=AB=8B=E4=B8=8A=E5=82=B3crates.io?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 +- ssrkit-macros/Cargo.toml | 13 ------------- ssrkit-macros/src/lib.rs | 26 -------------------------- 3 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 ssrkit-macros/Cargo.toml delete mode 100644 ssrkit-macros/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 1572cab..e8381de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,4 +22,4 @@ nanoid = "0.4.0" indoc = "2.0.5" lru = "0.12.4" -ssrkit-macros = { version = "0.1.0", path = "ssrkit-macros" } +ssrkit-macros = { version = "0.1.0", path = "../ssrkit-macros" } diff --git a/ssrkit-macros/Cargo.toml b/ssrkit-macros/Cargo.toml deleted file mode 100644 index 06fd47b..0000000 --- a/ssrkit-macros/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "ssrkit-macros" -version = "0.1.0" -edition = "2021" - -[lib] -proc-macro = true - -[dependencies] -syn = { version = "2.0.0", features = ["full"] } -quote = "1.0" -proc-macro2 = "1.0" -serde_json = "1.0" \ No newline at end of file diff --git a/ssrkit-macros/src/lib.rs b/ssrkit-macros/src/lib.rs deleted file mode 100644 index 27b49f8..0000000 --- a/ssrkit-macros/src/lib.rs +++ /dev/null @@ -1,26 +0,0 @@ -extern crate proc_macro; - -use proc_macro::TokenStream; -use quote::quote; -use syn::{parse_macro_input, Ident, ItemFn}; - -#[proc_macro_attribute] -pub fn params_handle(_attr: TokenStream, item: TokenStream) -> TokenStream { - let input = parse_macro_input!(item as ItemFn); - - let fn_name = &input.sig.ident; - let struct_name = Ident::new(&fn_name.to_string(), proc_macro2::Span::call_site()); - let fn_body = &input.block; - - let expanded = quote! { - pub struct #struct_name; - - impl ParamsProcessor for #struct_name { - fn process(&self, path: &str, params: &HashMap) -> serde_json::Map { - #fn_body - } - } - }; - - TokenStream::from(expanded) -}