diff options
| author | Jokler <jokler.contact@gmail.com> | 2018-03-12 16:02:51 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2018-03-12 16:02:51 +0100 |
| commit | 909cabe9280722e43c5fb283f768051bb85e1890 (patch) | |
| tree | 506ac34b7e22cdb95568cef9e649ee64cb3b0fdb /plugin_derive | |
| parent | 15e855ddecfdac31ddda26b12fcfd1a142a0ec21 (diff) | |
| parent | 8e40e919aca8b8592be43e2c5bbcc0717bf14a6b (diff) | |
| download | frippy-909cabe9280722e43c5fb283f768051bb85e1890.tar.gz frippy-909cabe9280722e43c5fb283f768051bb85e1890.zip | |
Merge branch 'dev'
Diffstat (limited to 'plugin_derive')
| -rw-r--r-- | plugin_derive/Cargo.toml | 11 | ||||
| -rw-r--r-- | plugin_derive/src/lib.rs | 27 |
2 files changed, 0 insertions, 38 deletions
diff --git a/plugin_derive/Cargo.toml b/plugin_derive/Cargo.toml deleted file mode 100644 index 0b62f9f..0000000 --- a/plugin_derive/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "plugin_derive" -version = "0.1.0" -authors = ["Jokler <jokler.contact@gmail.com>"] - -[lib] -proc-macro = true - -[dependencies] -syn = "0.11.11" -quote = "0.3.15" diff --git a/plugin_derive/src/lib.rs b/plugin_derive/src/lib.rs deleted file mode 100644 index 704d6ef..0000000 --- a/plugin_derive/src/lib.rs +++ /dev/null @@ -1,27 +0,0 @@ - -//! Provides the plugin derive macro - -extern crate proc_macro; -extern crate syn; -#[macro_use] -extern crate quote; - -use proc_macro::TokenStream; - -#[proc_macro_derive(PluginName)] -pub fn derive_plugin(data: TokenStream) -> TokenStream { - let ast = syn::parse_derive_input(&data.to_string()).unwrap(); - let gen = expand_plugin(&ast); - gen.parse().unwrap() -} - -fn expand_plugin(ast: &syn::DeriveInput) -> quote::Tokens { - let name = &ast.ident; - quote! { - impl PluginName for #name { - fn name(&self) -> &str { - stringify!(#name) - } - } - } -} |
