burn_derive/
lib.rs

1#![warn(missing_docs)]
2
3//! The derive crate of Burn.
4
5#[macro_use]
6extern crate derive_new;
7
8use proc_macro::TokenStream;
9
10pub(crate) mod config;
11pub(crate) mod module;
12pub(crate) mod record;
13pub(crate) mod shared;
14
15/// Derive macro for the module.
16#[proc_macro_derive(Module, attributes(module))]
17pub fn module_derive(input: TokenStream) -> TokenStream {
18    let input = syn::parse(input).unwrap();
19    module::derive_impl(&input)
20}
21
22/// Derive macro for the record.
23#[proc_macro_derive(Record)]
24pub fn record_derive(input: TokenStream) -> TokenStream {
25    let input = syn::parse(input).unwrap();
26    record::derive_impl(&input)
27}
28
29/// Derive macro for the config.
30#[proc_macro_derive(Config, attributes(config))]
31pub fn config_derive(input: TokenStream) -> TokenStream {
32    let item = syn::parse(input).unwrap();
33    config::derive_impl(&item)
34}