concision_macros/lib.rs
1/*
2 appellation: concision-macros <library>
3 authors: @FL03
4*/
5//! # concision-macros
6//!
7//! this crate defines various procedural macros for the `concision` crate working to
8//! streamline the process of creating and developing custom neural networks.
9//!
10
11pub(crate) mod ast;
12pub(crate) mod attr;
13pub(crate) mod impls;
14pub(crate) mod kw;
15
16use self::ast::ModelAst;
17use proc_macro::TokenStream;
18
19#[proc_macro]
20/// [`model_config!`] is a procedural macro used to define the configuration for a model in the
21/// `concision` framework. It allows users to specify various parameters and settings for the model
22/// in a concise and structured manner, declaring a name for their instanc
23pub fn model_config(input: TokenStream) -> TokenStream {
24 let data = syn::parse_macro_input!(input as ast::ConfigAst);
25 // use the handler to process the input data
26 let res = impls::impl_model_config(data);
27 // convert the tokens into a TokenStream
28 res.into()
29}
30
31#[proc_macro]
32/// the [`model!`]procedural macro is used to streamline the creation of custom models using the
33/// `concision` framework
34pub fn model(input: TokenStream) -> TokenStream {
35 let data = syn::parse_macro_input!(input as ModelAst);
36 // use the handler to process the input data
37 let res = impls::impl_model(data);
38 // convert the tokens into a TokenStream
39 res.into()
40}