macro_rules! write_fns { (public, $id_group:ident, $t:ty, $ids_data:expr) => { ... }; (private, $id_group:ident, $t:ty, $ids_data:expr) => { ... }; }
Expand description
Write a collection of getter functions returning a common type.
Makes the getter functions available for import into the main crate via use_symbols.
Parameters
publicorprivate: whether to make the functions publicly visible after import withuse_symbols.$id_group: the group alias by which these functions are referred when importing withuse_symbols.$t: the (common) return type of the getter functions.$ids_data: The list of type&[(I, $t)]where $t is as above, and I is a type implementing Display, though most commonly String or &’static str. This is a list of identifiers for the functions paired with their values.
Notes
- Intended for heap-allocated data. For stack-allocated data, consider
write_constsorwrite_staticinstead. - Rather than passing identifiers directly, they are passed as string (in fact Display-implementing) types. It is anticipated that this will be more convenient in the typical use cases of the write_Xs family of macros.