macro_rules! define_list_builder_accessors { { struct $OuterBuilder:ty { $( $vis:vis $things:ident: [$EntryBuilder:ty], )* } } => { ... }; }
Expand description
Define accessor methods for a configuration item which is a list
See the list_builder
module documentation for an overview.
Generates the following methods for each specified field:
impl $OuterBuilder {
pub fn $things(&mut self) -> &mut Vec<$EntryBuilder> { .. }
pub fn set_$things(&mut self, list: Vec<$EntryBuilder>) { .. }
pub fn opt_$things(&self) -> &Option<Vec<$EntryBuilder>> { .. }
pub fn opt_$things_mut>](&mut self) -> &mut Option<Vec<$EntryBuilder>> { .. }
}
Each $EntryBuilder
should have been defined by define_list_builder_helper
;
the method bodies from this macro rely on facilities which will beprovided by that macro.
You can call define_list_builder_accessors
once for a particular $OuterBuilder
,
with any number of fields with possibly different entry ($EntryBuilder
) types.