Break up library into macros and map nested libraries for shared dependency with constant map macro.
This commit is contained in:
parent
805874a4c1
commit
d037e22164
8 changed files with 88 additions and 39 deletions
16
macros/Cargo.toml
Normal file
16
macros/Cargo.toml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "macros"
|
||||
version = "0.0.0"
|
||||
authors = ["paladin <christian.lincoln25@ic.ac.uk>"]
|
||||
description = "Procedural macros for Deimos"
|
||||
keywords = ["template", "proc_macro", "procmacro"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
quote = "1"
|
||||
proc-macro2 = "1.0"
|
||||
syn = "1.0"
|
||||
map = { path = "../map" }
|
||||
19
macros/src/lib.rs
Normal file
19
macros/src/lib.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
use syn::{parse_macro_input, DeriveInput};
|
||||
use quote::quote;
|
||||
|
||||
/// Example of [function-like procedural macro][1].
|
||||
///
|
||||
/// [1]: https://doc.rust-lang.org/reference/procedural-macros.html#function-like-procedural-macros
|
||||
#[proc_macro]
|
||||
pub fn map(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
|
||||
let tokens = quote! {
|
||||
const
|
||||
};
|
||||
|
||||
tokens.into()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue