macro_rules! write_consts {
(public, $id_group:ident, $t:ty, $ids_data:expr) => { ... };
(private, $id_group:ident, $t:ty, $ids_data:expr) => { ... };
}Expand description
Write a collection of constants with a common type.
Makes the constants available for import into the main crate via use_symbols.
§Parameters
publicorprivate: whether to make the constants publicly visible after import withuse_symbols.$id_group: the group alias by which these variables are referred when importing withuse_symbols.$t: the (common) type of the static variables.$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 constants paired with their values.
§Notes
- Intended for stack-allocated data. For heap-allocated data, use
write_fnsinstead. - 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.