villain/
lib.rs

1extern crate proc_macro;
2use proc_macro::TokenStream;
3
4mod expand;
5mod parser;
6
7#[allow(clippy::needless_doctest_main)]
8/// Due to limitations in rusts proc-macro API there is currently no
9/// way to signal that a specific proc macro should be rerun if some
10/// external file changes/is added. This implies that `embed_migrations!`
11/// cannot regenerate the list of embedded migrations if **only** the
12/// migrations are changed. This limitation can be solved by adding a
13/// custom `build.rs` file to your crate, such that the crate is rebuild
14/// if the migration directory changes.
15///
16/// Add the following `build.rs` file to your project to fix the problem
17///
18/// ```
19/// fn main() {
20///    println!("cargo:rerun-if-changed=path/to/your/migration/dir/relative/to/your/Cargo.toml");
21/// }
22/// ```
23
24#[proc_macro]
25pub fn create_component(item: TokenStream) -> TokenStream {
26    expand::expand_template(item.to_string())
27}
28
29#[proc_macro]
30pub fn create_entypoint(item: TokenStream) -> TokenStream {
31    expand::expand_template(item.to_string())
32}