From b96e840a3f94627ccf36592d355596f82455f516 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Sun, 27 Feb 2022 18:24:23 +0000 Subject: [PATCH] initial commit --- .gitignore | 2 ++ .vscode/settings.json | 3 +++ Cargo.toml | 11 +++++++++++ LICENSE | 8 ++++++++ README.md | 3 +++ src/lib.rs | 21 +++++++++++++++++++++ 6 files changed, 48 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 Cargo.toml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..23fd35f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.formatOnSave": true +} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e7d5db3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "multi-entrypoint" +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/LICENSE b/LICENSE new file mode 100644 index 0000000..429d7db --- /dev/null +++ b/LICENSE @@ -0,0 +1,8 @@ +Copyright 2022 Jake Hillion + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..d44ea6b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# multi-entrypoint-rs + +Support library for multi-entrypoint applications written in Rust. diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..8190fa1 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,21 @@ +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn multi_entry_main(attr: TokenStream, item: TokenStream) -> TokenStream { + println!("multi_entry_main"); + + println!("attr: \"{}\"", attr.to_string()); + println!("item: \"{}\"", item.to_string()); + + item +} + +#[proc_macro_attribute] +pub fn entrypoint(attr: TokenStream, item: TokenStream) -> TokenStream { + println!("entrypoint"); + + println!("attr: \"{}\"", attr.to_string()); + println!("item: \"{}\"", item.to_string()); + + item +}