More autoderive things
This commit is contained in:
parent
258e813a39
commit
491face68b
@ -4,8 +4,8 @@ version = "0.1.0"
|
|||||||
authors = ["greg <greg.shuflin@protonmail.com>"]
|
authors = ["greg <greg.shuflin@protonmail.com>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
syn = "0.11.11"
|
syn = "0.13.1"
|
||||||
quote = "0.3.15"
|
quote = "0.5"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
@ -3,7 +3,9 @@ extern crate proc_macro;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate quote;
|
extern crate quote;
|
||||||
extern crate syn;
|
extern crate syn;
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
use syn::DeriveInput;
|
||||||
|
|
||||||
#[proc_macro]
|
#[proc_macro]
|
||||||
pub fn print_a_thing(_input: TokenStream) -> TokenStream {
|
pub fn print_a_thing(_input: TokenStream) -> TokenStream {
|
||||||
@ -13,7 +15,13 @@ pub fn print_a_thing(_input: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
#[proc_macro_derive(ProgrammingLanguageInterface)]
|
#[proc_macro_derive(ProgrammingLanguageInterface)]
|
||||||
pub fn derive_programming_language_interface(input: TokenStream) -> TokenStream {
|
pub fn derive_programming_language_interface(input: TokenStream) -> TokenStream {
|
||||||
input
|
let ast: DeriveInput = syn::parse(input).unwrap();
|
||||||
|
let name = &ast.ident;
|
||||||
|
let tokens = quote! {
|
||||||
|
impl ProgrammingLanguageInterface for #name {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tokens.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user