hephae_utils_derive/
lib.rs

1#![allow(internal_features)]
2#![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))]
3#![doc = include_str!("../README.md")]
4#![cfg_attr(doc, deny(missing_docs))]
5
6extern crate proc_macro;
7
8use hephae_macros::syn::Error;
9
10mod plugin_conf;
11mod plugin_def;
12
13/// Generates plugin/plugin-group structs that automatically derive [`Copy`], [`Clone`],
14/// [`Default`], and [`Debug`](core::fmt::Debug) regardless of the generic types.
15#[proc_macro]
16pub fn plugin_def(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
17    plugin_def::parse(input.into())
18        .unwrap_or_else(Error::into_compile_error)
19        .into()
20}
21
22/// Generates plugin configuration tuple types for use in plugin group builders.
23#[proc_macro]
24pub fn plugin_conf(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
25    plugin_conf::parse(input.into())
26        .unwrap_or_else(Error::into_compile_error)
27        .into()
28}