concision_linear/macros/
model.rs

1/*
2    Appellation: model <macros>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5
6macro_rules! mbuilder {
7    ($method:ident$(.$call:ident)? where $($rest:tt)*) => {
8        mbuilder!(@impl $method$(.$call)? where $($rest)*);
9    };
10    (@impl $method:ident where $($rest:tt)*) => {
11        mbuilder!(@impl $method.$method where $($rest)*);
12    };
13    (@impl $method:ident.$call:ident where $($rest:tt)*) => {
14        pub fn $method<Sh>(shape: Sh) -> Self
15        where
16            Sh: ndarray::ShapeBuilder<Dim = D>,
17            $($rest)*
18        {
19            Linear::from_params($crate::params::ParamsBase::$call(shape))
20        }
21    };
22}