]> saetta.ns0.it Git - rust/zakform_macro/commitdiff
Init zakform_macro.
authorAndrea Zagli <azagli@libero.it>
Tue, 7 Jul 2026 07:20:07 +0000 (09:20 +0200)
committerAndrea Zagli <azagli@libero.it>
Tue, 7 Jul 2026 07:20:07 +0000 (09:20 +0200)
.gitignore [new file with mode: 0644]
Cargo.lock [new file with mode: 0644]
Cargo.toml [new file with mode: 0644]
src/main.rs [new file with mode: 0644]
zakform_macro/Cargo.toml [new file with mode: 0644]
zakform_macro/src/lib.rs [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..3e19354
--- /dev/null
@@ -0,0 +1,2 @@
+/target
+*.~*~
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644 (file)
index 0000000..765c0bf
--- /dev/null
@@ -0,0 +1,101 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "darling"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d"
+dependencies = [
+ "darling_core",
+ "darling_macro",
+]
+
+[[package]]
+name = "darling_core"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0"
+dependencies = [
+ "ident_case",
+ "proc-macro2",
+ "quote",
+ "strsim",
+ "syn",
+]
+
+[[package]]
+name = "darling_macro"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"
+dependencies = [
+ "darling_core",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "ident_case"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.106"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "strsim"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+
+[[package]]
+name = "syn"
+version = "2.0.118"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+
+[[package]]
+name = "zakform_macro"
+version = "0.1.0"
+dependencies = [
+ "darling",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "zakform_macro_app"
+version = "0.1.0"
+dependencies = [
+ "zakform_macro",
+]
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644 (file)
index 0000000..7e6021c
--- /dev/null
@@ -0,0 +1,9 @@
+workspace = { members = ["zakform_macro"] }
+
+[package]
+name = "zakform_macro_app"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+zakform_macro = { path = "./zakform_macro" }
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
new file mode 100644 (file)
index 0000000..535f414
--- /dev/null
@@ -0,0 +1,13 @@
+use zakform_macro::IntoStringHashMap;
+
+#[derive(IntoStringHashMap)]
+pub struct User {
+    username: String,
+    first_name: String,
+    last_name: String,
+    age: u32,
+}
+
+fn main() {
+    println!("Hello, world!");
+}
diff --git a/zakform_macro/Cargo.toml b/zakform_macro/Cargo.toml
new file mode 100644 (file)
index 0000000..24b09bc
--- /dev/null
@@ -0,0 +1,15 @@
+[package]
+name = "zakform_macro"
+version = "0.1.0"
+edition = "2024"
+
+[lib]
+name = "zakform_macro"
+path = "src/lib.rs"
+proc-macro = true
+
+[dependencies]
+darling = "0.23"
+proc-macro2 = "1.0"
+quote = "1.0"
+syn = "2.0"
diff --git a/zakform_macro/src/lib.rs b/zakform_macro/src/lib.rs
new file mode 100644 (file)
index 0000000..d67d775
--- /dev/null
@@ -0,0 +1,12 @@
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+use quote::quote;
+
+#[proc_macro_derive(IntoStringHashMap)]
+pub fn derive_into_hash_map(item: TokenStream) -> TokenStream {
+    //todo!()
+       println!("HELLO FROM MACRO");
+
+       proc_macro::TokenStream::from(quote!{})
+}