Starting to write custom derive for ProgrammingLanguageInterface
This commit is contained in:
parent
5d69b530c5
commit
258e813a39
@ -4,6 +4,8 @@ version = "0.1.0"
|
|||||||
authors = ["greg <greg.shuflin@protonmail.com>"]
|
authors = ["greg <greg.shuflin@protonmail.com>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
syn = "0.11.11"
|
||||||
|
quote = "0.3.15"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#![feature(proc_macro)]
|
#![feature(proc_macro)]
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate quote;
|
||||||
|
extern crate syn;
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
|
||||||
#[proc_macro]
|
#[proc_macro]
|
||||||
@ -7,6 +10,12 @@ pub fn print_a_thing(_input: TokenStream) -> TokenStream {
|
|||||||
"println!(\"Invoked from a proc macro\");".parse().unwrap()
|
"println!(\"Invoked from a proc macro\");".parse().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[proc_macro_derive(ProgrammingLanguageInterface)]
|
||||||
|
pub fn derive_programming_language_interface(input: TokenStream) -> TokenStream {
|
||||||
|
input
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user