Macro metaheuristics_nature::impl_builders
source ·
[−]macro_rules! impl_builders {
($($(#[$meta : meta]) * fn $name : ident($ty : ty)) +) => { ... };
}
Expand description
A tool macro used to generate multiple builder functions (methods).
For example,
impl S {
impl_builders! {
/// Doc 1
fn name1(Ty)
/// Doc 2
fn name2(Ty)
}
}
will become
impl S {
/// Doc 1
pub fn name1(mut self, name1: Ty) -> Self {
self.name1 = name1;
self
}
/// Doc 2
pub fn name2(mut self, name2: Ty) -> Self {
self.name2 = name2;
self
}
}