summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graph_macro/Cargo.toml11
-rw-r--r--graph_macro/src/lib.rs12
-rw-r--r--graph_macro/tests/works.rs13
3 files changed, 36 insertions, 0 deletions
diff --git a/graph_macro/Cargo.toml b/graph_macro/Cargo.toml
new file mode 100644
index 0000000..1e4c4db
--- /dev/null
+++ b/graph_macro/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "graph_macro"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[lib]
+proc-macro = true
+
+[dependencies]
diff --git a/graph_macro/src/lib.rs b/graph_macro/src/lib.rs
new file mode 100644
index 0000000..5a0672b
--- /dev/null
+++ b/graph_macro/src/lib.rs
@@ -0,0 +1,12 @@
+//! This file provides a macro to delegate the implementation of a
+//! type that wraps a graph. More precisely, the macro helps the
+//! wrapper type implement the various Graph-related traits.
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Testing)]
+pub fn test_derive(input: TokenStream) -> TokenStream {
+ println!("input: {input:?}");
+
+ TokenStream::new()
+}
diff --git a/graph_macro/tests/works.rs b/graph_macro/tests/works.rs
new file mode 100644
index 0000000..fe8a853
--- /dev/null
+++ b/graph_macro/tests/works.rs
@@ -0,0 +1,13 @@
+#![allow(dead_code)]
+
+use graph_macro::Testing;
+
+#[derive(Debug, Testing)]
+struct Haha {
+ size: usize,
+}
+
+#[test]
+fn it_works() {
+ println!("it works: {:?}", Haha { size: 0 });
+}