Update the impl_builder_methods macro to let all chain methods in a single impl block

This commit is contained in:
Night Cruising
2023-10-18 16:03:58 +08:00
parent eaa811d07a
commit fde7295d43

View File

@ -10,13 +10,13 @@ pub struct Usage {
#[macro_export] #[macro_export]
macro_rules! impl_builder_methods { macro_rules! impl_builder_methods {
($builder:ident, $($field:ident: $field_type:ty),*) => { ($builder:ident, $($field:ident: $field_type:ty),*) => {
$( impl $builder {
impl $builder { $(
pub fn $field(mut self, $field: $field_type) -> Self { pub fn $field(mut self, $field: $field_type) -> Self {
self.$field = Some($field); self.$field = Some($field);
self self
} }
} )*
)* }
}; };
} }